summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 21:23:40 +0000
committerlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 21:23:40 +0000
commit01e9ffa3e5962fee4e07ec7ff82eca32348a0416 (patch)
tree27c742e1d75b773e09d26d596f1b2ab18ff81f84
parent227182ae985b88ee2de229e38875000980fe7baf (diff)
downloadchromium_src-01e9ffa3e5962fee4e07ec7ff82eca32348a0416.zip
chromium_src-01e9ffa3e5962fee4e07ec7ff82eca32348a0416.tar.gz
chromium_src-01e9ffa3e5962fee4e07ec7ff82eca32348a0416.tar.bz2
And a flag to disable safebrowsing warning ui.
TEST=none BUG=none Review URL: http://codereview.chromium.org/6602053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76614 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/download/download_safe_browsing_client.cc17
-rw-r--r--chrome/common/chrome_switches.cc7
-rw-r--r--chrome/common/chrome_switches.h1
3 files changed, 22 insertions, 3 deletions
diff --git a/chrome/browser/download/download_safe_browsing_client.cc b/chrome/browser/download/download_safe_browsing_client.cc
index 3873c2c..bbce50f 100644
--- a/chrome/browser/download/download_safe_browsing_client.cc
+++ b/chrome/browser/download/download_safe_browsing_client.cc
@@ -5,12 +5,14 @@
#include "chrome/browser/download/download_safe_browsing_client.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/stats_counters.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/history/download_create_info.h"
+#include "chrome/common/chrome_switches.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
@@ -25,6 +27,8 @@ DownloadSBClient::DownloadSBClient(DownloadCreateInfo* info) : info_(info) {
sb_service_ = rdh->safe_browsing_service();
}
+DownloadSBClient::~DownloadSBClient() {}
+
void DownloadSBClient::CheckDownloadUrl(DoneCallback* callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// It is not allowed to call this method twice.
@@ -64,13 +68,20 @@ void DownloadSBClient::OnDownloadUrlCheckResult(
Release();
}
-DownloadSBClient::~DownloadSBClient() {}
-
void DownloadSBClient::SafeBrowsingCheckUrlDone(
SafeBrowsingService::UrlCheckResult result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DVLOG(1) << "SafeBrowsingCheckUrlDone with result: " << result;
+
bool is_dangerous = result != SafeBrowsingService::SAFE;
- done_callback_->Run(info_, is_dangerous);
+ CommandLine* cmdline = CommandLine::ForCurrentProcess();
+ if (!cmdline->HasSwitch(switches::kSbEnableDownloadWarningUI)) {
+ // Always ignore the safebrowsing result without the flag.
+ done_callback_->Run(info_, false);
+ } else {
+ done_callback_->Run(info_, is_dangerous);
+ }
+
UMA_HISTOGRAM_TIMES("SB2.DownloadUrlCheckDuration",
base::TimeTicks::Now() - start_time_);
if (is_dangerous) {
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 60be9b6..d06a4e8 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1107,6 +1107,13 @@ const char kSbDisableAutoUpdate[] = "safebrowsing-disable-auto-update";
// to make sure the content are not malicious.
const char kSbEnableDownloadProtection[] = "safebrowsing-download-protection";
+// This flag is used together with kSbEnableDownloadProtection. When that flag
+// is present but this flag is absent, we won't show the warning ui. The purpose
+// of this flag is to make sure we roll out download url detection smoothly.
+// We will remove this flag once we verify that the download url detection works
+// as expectecd according to UMA reports.
+const char kSbEnableDownloadWarningUI[] = "safebrowsing-download-warning-ui";
+
// Enable support for SDCH filtering (dictionary based expansion of content).
// Optional argument is *the* only domain name that will have SDCH suppport.
// Default is "-enable-sdch" to advertise SDCH on all domains.
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index a9078d2..e12be32 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -308,6 +308,7 @@ extern const char kSbInfoURLPrefix[];
extern const char kSbMacKeyURLPrefix[];
extern const char kSbDisableAutoUpdate[];
extern const char kSbEnableDownloadProtection[];
+extern const char kSbEnableDownloadWarningUI[];
extern const char kSdchFilter[];
extern const char kSearchInOmniboxHint[];
extern const char kServiceProcess[];