summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbryner@chromium.org <bryner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 00:35:40 +0000
committerbryner@chromium.org <bryner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 00:35:40 +0000
commit3deae73c20c6f1d28ac79e26bf512c579e245259 (patch)
tree8102cf9417bc94cb42a6b3974730870dee375835
parentdefcaa0145f24ce187584837ecef911701f28928 (diff)
downloadchromium_src-3deae73c20c6f1d28ac79e26bf512c579e245259.zip
chromium_src-3deae73c20c6f1d28ac79e26bf512c579e245259.tar.gz
chromium_src-3deae73c20c6f1d28ac79e26bf512c579e245259.tar.bz2
Turn on client-side phishing detection for UMA users with SafeBrowsing enabled.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6708059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79931 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_process_impl.cc4
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc6
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc9
-rw-r--r--chrome/common/chrome_switches.cc14
-rw-r--r--chrome/common/chrome_switches.h2
-rw-r--r--content/renderer/render_view.cc4
6 files changed, 20 insertions, 19 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 89ea85a..dffef5d 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -935,8 +935,8 @@ void BrowserProcessImpl::CreateSafeBrowsingDetectionService() {
bool BrowserProcessImpl::IsSafeBrowsingDetectionServiceEnabled() {
// The safe browsing client-side detection is enabled only if the switch is
// enabled and when safe browsing related stats is allowed to be collected.
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableClientSidePhishingDetection) &&
+ return !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableClientSidePhishingDetection) &&
resource_dispatcher_host()->safe_browsing_service() &&
resource_dispatcher_host()->safe_browsing_service()->CanReportStats();
}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 1fa4d36..795d304 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -785,10 +785,10 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
renderer_cmd->AppendSwitch(switches::kDisableDatabases);
}
- // Only enable client-side phishing detection in the renderer if it is enabled
+ // Disable client-side phishing detection in the renderer if it is disabled
// in the browser process.
- if (g_browser_process->safe_browsing_detection_service()) {
- renderer_cmd->AppendSwitch(switches::kEnableClientSidePhishingDetection);
+ if (!g_browser_process->safe_browsing_detection_service()) {
+ renderer_cmd->AppendSwitch(switches::kDisableClientSidePhishingDetection);
}
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index e31ffba..7e33e6b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -243,10 +243,11 @@ bool SafeBrowsingService::CheckDownloadHash(const std::string& full_hash,
bool SafeBrowsingService::MatchCsdWhitelistUrl(const GURL& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(enable_csd_whitelist_);
if (!enabled_ || !enable_csd_whitelist_ || !MakeDatabaseAvailable()) {
- // There is something funky going on here. Just to be safe we return
- // true in this case.
+ // There is something funky going on here -- for example, perhaps the user
+ // has not restarted since enabling metrics reporting, so we haven't
+ // enabled the csd whitelist yet. Just to be safe we return true in this
+ // case.
return true;
}
return database_->ContainsCsdWhitelistedUrl(url);
@@ -882,7 +883,7 @@ void SafeBrowsingService::Start() {
// cannot check whether the metrics_service() object is created because it
// may be initialized after this method is called.
enable_csd_whitelist_ =
- (cmdline->HasSwitch(switches::kEnableClientSidePhishingDetection) &&
+ (!cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection) &&
local_state && local_state->GetBoolean(prefs::kMetricsReportingEnabled));
BrowserThread::PostTask(
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index ddf5bf29..5e7484fe 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -192,6 +192,13 @@ const char kDisableBackgroundNetworking[] = "disable-background-networking";
const char kDisableBlockContentAnimation[] =
"disable-blocked-content-animation";
+// This switch is used to disable the client-side phishing detection feature.
+// Note that even if client-side phishing detection is enabled, it will only
+// be active if the user has opted in to UMA stats and SafeBrowsing is enabled
+// in the preferences.
+const char kDisableClientSidePhishingDetection[] =
+ "disable-client-side-phishing-detection";
+
// Disables establishing a backup TCP connection if a specified timeout is
// exceeded.
const char kDisableConnectBackupJobs[] = "disable-connect-backup-jobs";
@@ -402,13 +409,6 @@ const char kEnableAeroPeekTabs[] = "enable-aero-peek-tabs";
// for more background.
const char kEnableAuthNegotiatePort[] = "enable-auth-negotiate-port";
-// In the browser process this switch is used to enable or disable the
-// client-side phishing detection. In the renderer this switch is only enabled
-// if this switch is enabled in the browser and the user has opted in to UMA
-// stats and SafeBrowsing is enabled in the preferences.
-const char kEnableClientSidePhishingDetection[] =
- "enable-client-side-phishing-detection";
-
// At this point, even if client-side phishing detection is enabled we will not,
// by default, display an interstitial if we detected a phishing site. Once
// we are confident that the false-positive rate is as low as expected we can
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 430f9f2..546aa10 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -66,6 +66,7 @@ extern const char kDisableAuthNegotiateCnameLookup[];
extern const char kDisableBackgroundMode[];
extern const char kDisableBackgroundNetworking[];
extern const char kDisableBlockContentAnimation[];
+extern const char kDisableClientSidePhishingDetection[];
extern const char kDisableConnectBackupJobs[];
extern const char kDisableCustomJumpList[];
extern const char kDisableDevTools[];
@@ -125,7 +126,6 @@ extern const char kEnableAcceleratedPlugins[];
extern const char kEnableAccessibility[];
extern const char kEnableAeroPeekTabs[];
extern const char kEnableAuthNegotiatePort[];
-extern const char kEnableClientSidePhishingDetection[];
extern const char kEnableClientSidePhishingInterstitial[];
extern const char kEnableClearServerData[];
extern const char kEnableClickToPlay[];
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 86733e4..4561e7a 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -639,8 +639,8 @@ RenderView::RenderView(RenderThreadBase* render_thread,
p2p_socket_dispatcher_ = new P2PSocketDispatcher(this);
}
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableClientSidePhishingDetection)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableClientSidePhishingDetection)) {
new safe_browsing::PhishingClassifierDelegate(this, NULL);
}