Split to SafeBrowsingDatabaseManager into Local* and Remote*.

SafeBrowsingDatabaseManager: Pure interface
  TestSafeBrowsingDatabaseManager: Dummy impl for tests
  LocalSafeBrowsingDatabaseManager: Existing full impl.
  RemoteSafeBrowsingDatabaseManager: New for Android

Wire up the safe_browsing=3 build-mode to switch Android to
use Remote*.  Move SafeBrowsingCheck into Local* and create
the Test* impl that can't accidentally call a real
implementation's methods.  Adjust tests to use either Test*
or Local*.

The initial implementation of Remote* does the bookeeping
of requests, but doesn't yet make calls to Java and isn't
tested.

BUG=474608

Review URL: https://codereview.chromium.org/1110723002

Cr-Original-Commit-Position: refs/heads/master@{#329551}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b2cd5eef530be7100274af882af3f5aff4d1c4be
This commit is contained in:
nparker 2015-05-12 18:12:01 -07:00 коммит произвёл Commit bot
Родитель 210c3b1345
Коммит b7b417cbf6
3 изменённых файлов: 23 добавлений и 11 удалений

Просмотреть файл

@ -371,11 +371,11 @@
'configuration_policy%': 1,
# Variable safe_browsing is used to control the build time configuration
# for safe browsing feature. Safe browsing can be compiled in 3 different
# for safe browsing feature. Safe browsing can be compiled in 4 different
# levels: 0 disables it, 1 enables it fully, and 2 enables only UI and
# reporting features without enabling phishing and malware detection. This
# is useful to integrate a third party phishing/malware detection to
# existing safe browsing logic.
# reporting features for use with Data Saver on Mobile, and 3 enables
# extended mobile protection via an external API. When 3 is fully
# deployed, it will replace 2.
'safe_browsing%': 1,
# Web speech is enabled by default. Set to 0 to disable.
@ -3008,8 +3008,8 @@
# SAFE_BROWSING_DB_REMOTE - service talks via API to a database
# SAFE_BROWSING_CSD - enable client-side phishing detection.
['safe_browsing==1', {
# TODO(nparker): Remove existing uses of FULL_SAFE_BROWSING
'defines': [
# TODO(nparker): Remove existing uses of FULL_SAFE_BROWSING
'FULL_SAFE_BROWSING',
'SAFE_BROWSING_CSD',
'SAFE_BROWSING_DB_LOCAL',
@ -3023,6 +3023,14 @@
'SAFE_BROWSING_SERVICE',
],
}],
['safe_browsing==3', {
'defines': [
# TODO(nparker): Remove existing uses of MOBILE_SAFE_BROWSING
'MOBILE_SAFE_BROWSING',
'SAFE_BROWSING_DB_REMOTE',
'SAFE_BROWSING_SERVICE',
],
}],
], # conditions for 'target_defaults'
'target_conditions': [
['<(use_libpci)==1', {

Просмотреть файл

@ -235,6 +235,10 @@ config("feature_flags") {
} else if (safe_browsing_mode == 2) {
defines += [ "MOBILE_SAFE_BROWSING" ]
defines += [ "SAFE_BROWSING_SERVICE" ]
} else if (safe_browsing_mode == 3) {
defines += [ "MOBILE_SAFE_BROWSING" ]
defines += [ "SAFE_BROWSING_DB_REMOTE" ]
defines += [ "SAFE_BROWSING_SERVICE" ]
}
if (is_official_build) {
defines += [ "OFFICIAL_BUILD" ]

Просмотреть файл

@ -89,12 +89,12 @@ declare_args() {
# (e.g. Android and ChromeCast) that use a browser side CDM.
enable_browser_cdms = is_android
# Variable safe_browsing is used to control the build time configuration for
# safe browsing feature. Safe browsing can be compiled in 3 different levels:
# 0 disables it, 1 enables it fully, and 2 enables only UI and reporting
# features without enabling phishing and malware detection. This is useful to
# integrate a third party phishing/malware detection to existing safe browsing
# logic.
# Variable safe_browsing is used to control the build time configuration
# for safe browsing feature. Safe browsing can be compiled in 4 different
# levels: 0 disables it, 1 enables it fully, and 2 enables only UI and
# reporting features for use with Data Saver on Mobile, and 3 enables
# extended mobile protection via an external API. When 3 is fully deployed,
# it will replace 2.
if (is_android) {
safe_browsing_mode = 2
} else if (is_ios) {