Remove safe_browsing=2 functionality, replace with =3 mode.
Remove refs to SAFE_BROWSING_SERVICE, MOBILE_SAFE_BROWSING,
and removes the half-dead code that supported
FULL_SAFE_BROWSING on Android.
This affects no change in functionality.
BUG=542795
Review URL: https://codereview.chromium.org/1402783005
Cr-Commit-Position: refs/heads/master@{#354535}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 08593186..5d0b829 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -505,11 +505,11 @@
if (is_win) {
deps += [ "//chrome/browser/safe_browsing/incident_reporting:state_store_data_proto" ]
}
- } else if (safe_browsing_mode == 3) {
- sources += rebase_path(
- gypi_values.chrome_browser_safe_browsing_mobile_extended_sources,
- ".",
- "//chrome")
+ } else if (safe_browsing_mode == 2) {
+ sources +=
+ rebase_path(gypi_values.chrome_browser_safe_browsing_mobile_sources,
+ ".",
+ "//chrome")
}
}
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 876bc45..170c211 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -258,10 +258,8 @@
// URLFetcher operation before going away.)
metrics_services_manager_.reset();
intranet_redirect_detector_.reset();
-#if defined(SAFE_BROWSING_SERVICE)
if (safe_browsing_service_.get())
safe_browsing_service()->ShutDown();
-#endif
#if defined(ENABLE_PLUGIN_INSTALLATION)
plugins_resource_service_.reset();
#endif
@@ -1159,10 +1157,8 @@
// Set this flag to true so that we don't retry indefinitely to
// create the service class if there was an error.
created_safe_browsing_service_ = true;
-#if defined(SAFE_BROWSING_SERVICE)
safe_browsing_service_ = SafeBrowsingService::CreateSafeBrowsingService();
safe_browsing_service_->Initialize();
-#endif
}
void BrowserProcessImpl::CreateGCMDriver() {
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index d15c72b..7f08d3c4 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -487,7 +487,6 @@
storage_partition_remove_mask |=
content::StoragePartition::REMOVE_DATA_MASK_COOKIES;
-#if defined(SAFE_BROWSING_SERVICE)
// Clear the safebrowsing cookies only if time period is for "all time". It
// doesn't make sense to apply the time period of deleting in the last X
// hours/days to the safebrowsing cookies since they aren't the result of
@@ -505,7 +504,7 @@
base::Unretained(this), base::Unretained(sb_context)));
}
}
-#endif
+
MediaDeviceIDSalt::Reset(profile_->GetPrefs());
// TODO(mkwst): If we're not removing passwords, then clear the 'zero-click'
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index b3ff6a96..a7a47d1 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -339,7 +339,6 @@
DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester);
};
-#if defined(SAFE_BROWSING_SERVICE)
class RemoveSafeBrowsingCookieTester : public RemoveCookieTester {
public:
RemoveSafeBrowsingCookieTester()
@@ -370,7 +369,6 @@
DISALLOW_COPY_AND_ASSIGN(RemoveSafeBrowsingCookieTester);
};
-#endif
class RemoveChannelIDTester : public net::SSLConfigService::Observer {
public:
@@ -1070,7 +1068,6 @@
EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
}
-#if defined(SAFE_BROWSING_SERVICE)
TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) {
RemoveSafeBrowsingCookieTester tester;
@@ -1100,7 +1097,6 @@
// browsing cookies.
EXPECT_TRUE(tester.ContainsCookie());
}
-#endif
TEST_F(BrowsingDataRemoverTest, RemoveChannelIDForever) {
RemoveChannelIDTester tester(GetProfile());
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index b1bae98..a21f7b70 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -191,13 +191,11 @@
void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
download_manager_ = dm;
-#if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service();
if (sb_service && !profile_->IsOffTheRecord()) {
// Include this download manager in the set monitored by safe browsing.
sb_service->AddDownloadManager(dm);
}
-#endif
}
void ChromeDownloadManagerDelegate::Shutdown() {
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index c0f8e5c57..908df15e 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -159,12 +159,10 @@
// Set initialized_ to true at the beginning in case any of the objects
// below try to get the ResourceContext pointer.
initialized_ = true;
-#if defined(SAFE_BROWSING_SERVICE)
io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
profile_->GetPrefs());
io_data_->safe_browsing_enabled()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
-#endif
io_data_->InitializeOnUIThread(profile_);
}
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index e0ca85f1..f8f5336 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -386,12 +386,10 @@
prefs::kRestoreOnStartup, pref_service);
io_data_->session_startup_pref()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
-#if defined(SAFE_BROWSING_SERVICE)
io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
pref_service);
io_data_->safe_browsing_enabled()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
-#endif
io_data_->InitializeOnUIThread(profile_);
}
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index b28332e..e86ef16 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -485,10 +485,10 @@
// Insert either safe browsing or data reduction proxy throttle at the front
// of the list, so one of them gets to decide if the resource is safe.
content::ResourceThrottle* first_throttle = NULL;
-#if defined(OS_ANDROID) && defined(SAFE_BROWSING_SERVICE)
+#if defined(OS_ANDROID)
first_throttle = DataReductionProxyResourceThrottle::MaybeCreate(
request, resource_context, resource_type, safe_browsing_.get());
-#endif // defined(OS_ANDROID) && defined(SAFE_BROWSING_SERVICE)
+#endif // defined(OS_ANDROID)
#if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
if (!first_throttle && io_data->safe_browsing_enabled()->GetValue()) {
diff --git a/chrome/browser/safe_browsing/local_database_manager.cc b/chrome/browser/safe_browsing/local_database_manager.cc
index fd461dbc..5ac0c50 100644
--- a/chrome/browser/safe_browsing/local_database_manager.cc
+++ b/chrome/browser/safe_browsing/local_database_manager.cc
@@ -273,9 +273,6 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(sb_service_.get() != NULL);
- // Android only supports a subset of FULL_SAFE_BROWSING.
- // TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379>
-#if !defined(OS_ANDROID)
base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
enable_download_protection_ =
!cmdline->HasSwitch(switches::kSbDisableDownloadProtection);
@@ -298,7 +295,6 @@
// The client-side IP blacklist feature is tightly integrated with client-side
// phishing protection for now.
enable_ip_blacklist_ = enable_csd_whitelist_;
-#endif
}
LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() {
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 054d5e1..745a9d7f 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -29,10 +29,6 @@
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
-#if defined(OS_ANDROID)
-#include "net/base/network_change_notifier.h"
-#endif
-
using base::Time;
using base::TimeDelta;
@@ -148,9 +144,6 @@
url_prefix_(config.url_prefix),
backup_update_reason_(BACKUP_UPDATE_REASON_MAX),
disable_auto_update_(config.disable_auto_update),
-#if defined(OS_ANDROID)
- disable_connection_check_(config.disable_connection_check),
-#endif
url_fetcher_id_(0),
app_in_foreground_(true) {
DCHECK(!url_prefix_.empty());
@@ -235,17 +228,6 @@
if (request_.get() || request_type_ != NO_REQUEST)
return;
-#if defined(OS_ANDROID)
- if (!disable_connection_check_) {
- net::NetworkChangeNotifier::ConnectionType type =
- net::NetworkChangeNotifier::GetConnectionType();
- if (type != net::NetworkChangeNotifier::CONNECTION_WIFI) {
- ScheduleNextUpdate(false /* no back off */);
- return;
- }
- }
-#endif
-
IssueUpdateRequest();
}
@@ -728,12 +710,6 @@
void SafeBrowsingProtocolManager::UpdateFinished(bool success, bool back_off) {
DCHECK(CalledOnValidThread());
-#if defined(OS_ANDROID)
- if (app_in_foreground_)
- UMA_HISTOGRAM_COUNTS("SB2.UpdateSizeForeground", update_size_);
- else
- UMA_HISTOGRAM_COUNTS("SB2.UpdateSizeBackground", update_size_);
-#endif
UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_);
update_size_ = 0;
bool update_success = success || request_type_ == CHUNK_REQUEST;
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index e8bb43f0..bfbd2c1 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -377,12 +377,6 @@
// ForceScheduleNextUpdate() is called. This is set for testing purpose.
bool disable_auto_update_;
-#if defined(OS_ANDROID)
- // When true, protocol_manager will not check network connection
- // type when scheduling next update. This is set for testing purpose.
- bool disable_connection_check_;
-#endif
-
// ID for URLFetchers for testing.
int url_fetcher_id_;
diff --git a/chrome/browser/safe_browsing/protocol_manager_helper.cc b/chrome/browser/safe_browsing/protocol_manager_helper.cc
index c0e0d1f..571385b7 100644
--- a/chrome/browser/safe_browsing/protocol_manager_helper.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_helper.cc
@@ -17,15 +17,9 @@
#include "net/base/escape.h"
SafeBrowsingProtocolConfig::SafeBrowsingProtocolConfig()
- : disable_auto_update(false)
-#if defined(OS_ANDROID)
- , disable_connection_check(false)
-#endif
-{
-}
+ : disable_auto_update(false) {}
-SafeBrowsingProtocolConfig::~SafeBrowsingProtocolConfig() {
-}
+SafeBrowsingProtocolConfig::~SafeBrowsingProtocolConfig() {}
// static
std::string SafeBrowsingProtocolManagerHelper::Version() {
diff --git a/chrome/browser/safe_browsing/protocol_manager_helper.h b/chrome/browser/safe_browsing/protocol_manager_helper.h
index 04110d6..925ce915 100644
--- a/chrome/browser/safe_browsing/protocol_manager_helper.h
+++ b/chrome/browser/safe_browsing/protocol_manager_helper.h
@@ -24,9 +24,6 @@
std::string backup_network_error_url_prefix;
std::string version;
bool disable_auto_update;
-#if defined(OS_ANDROID)
- bool disable_connection_check;
-#endif
};
class SafeBrowsingProtocolManagerHelper {
diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
index fae2de1..31b18f9 100644
--- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
@@ -37,13 +37,8 @@
const char kAdditionalQuery[] = "additional_query";
const char kUrlSuffix[] = "&ext=0";
-#if defined(OS_ANDROID)
-const char kDefaultPhishList[] = "goog-mobilephish-shavar";
-const char kDefaultMalwareList[] = "goog-mobilemalware-shavar";
-#else
const char kDefaultPhishList[] = "goog-phish-shavar";
const char kDefaultMalwareList[] = "goog-malware-shavar";
-#endif
// Add-prefix chunk with single prefix.
const char kRawChunkPayload1[] = {
@@ -91,9 +86,6 @@
config.backup_http_error_url_prefix = kBackupHttpUrlPrefix;
config.backup_network_error_url_prefix = kBackupNetworkUrlPrefix;
config.version = kAppVer;
-#if defined(OS_ANDROID)
- config.disable_connection_check = true;
-#endif
return scoped_ptr<SafeBrowsingProtocolManager>(
SafeBrowsingProtocolManager::Create(delegate, NULL, config));
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 5a7929e..f593448 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -73,17 +73,7 @@
// for little benefit. If/when file formats change (say to put all
// the data in one file), that would be a convenient point to rectify
// this.
-// TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379>
-#if defined(OS_ANDROID)
-// NOTE(shess): This difference is also reflected in the list name in
-// safe_browsing_util.cc.
-// TODO(shess): Spin up an alternate list id which can be persisted in the
-// store. Then if a mistake is made, it won't cause confusion between
-// incompatible lists.
-const base::FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Mobile");
-#else
const base::FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Bloom");
-#endif
// Maximum number of entries we allow in any of the whitelists.
// If a whitelist on disk contains more entries then all lookups to
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index fc2f2ed..d1c8694 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -251,12 +251,8 @@
}
#endif // defined(SAFE_BROWSING_CSD)
-// TODO(nparker): Adding SAFE_BROWSING_SERVICE_DOWNLOAD to control this might
-// allow removing FULL_SAFE_BROWSING above.
-#if !defined(OS_ANDROID)
download_service_.reset(new safe_browsing::DownloadProtectionService(
this, url_request_context_getter_.get()));
-#endif
if (safe_browsing::IncidentReportingService::IsEnabled()) {
incident_service_.reset(new safe_browsing::IncidentReportingService(
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index 5a98689..54fd804 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -89,9 +89,6 @@
// Makes sure the auto update is not triggered. The tests will force the
// update when needed.
config.disable_auto_update = true;
-#if defined(OS_ANDROID)
- config.disable_connection_check = true;
-#endif
config.client_name = "browser_tests";
return config;
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 60b215e..e50cd25 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -120,9 +120,6 @@
// Makes sure the auto update is not triggered. The tests will force the
// update when needed.
config.disable_auto_update = true;
-#if defined(OS_ANDROID)
- config.disable_connection_check = true;
-#endif
config.client_name = "browser_tests";
return config;
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index 728bd96..b4ff66f 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -173,16 +173,8 @@
namespace safe_browsing_util {
// Listnames that browser can process.
-// TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379>
-#if defined(OS_ANDROID)
-// NOTE(shess): This difference is also reflected in the store name in
-// safe_browsing_database.cc.
-const char kMalwareList[] = "goog-mobilemalware-shavar";
-const char kPhishingList[] = "goog-mobilephish-shavar";
-#else
const char kMalwareList[] = "goog-malware-shavar";
const char kPhishingList[] = "goog-phish-shavar";
-#endif
const char kBinUrlList[] = "goog-badbinurl-shavar";
const char kCsdWhiteList[] = "goog-csdwhite-sha256";
const char kDownloadWhiteList[] = "goog-downloadwhite-digest256";