Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 2868030: Add switches and apis in safebrowsing code to allow tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_service.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_service.cc (revision 51059)
+++ chrome/browser/safe_browsing/safe_browsing_service.cc (working copy)
@@ -6,6 +6,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
@@ -20,6 +21,7 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -32,6 +34,15 @@
using base::Time;
using base::TimeDelta;
+// The default URL prefix where browser fetches chunk updates, hashes,
+// and reports malware.
+static const char* const kSbDefaultInfoURLPrefix =
+ "http://safebrowsing.clients.google.com/safebrowsing";
+
+// The default URL prefix where browser fetches MAC client key.
+static const char* const kSbDefaultMacKeyURLPrefix =
+ "https://sb-ssl.google.com/safebrowsing";
+
static Profile* GetDefaultProfile() {
FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
@@ -233,6 +244,11 @@
}
}
+bool SafeBrowsingService::IsUpdateInProgress() const {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ return update_in_progress_;
+}
+
void SafeBrowsingService::OnBlockingPageDone(
const std::vector<UnsafeResource>& resources,
bool proceed) {
@@ -345,12 +361,25 @@
std::string client_name("chromium");
#endif
#endif
+ CommandLine* cmdline = CommandLine::ForCurrentProcess();
+ bool disable_auto_update = cmdline->HasSwitch(switches::kSbDisableAutoUpdate);
+ std::string info_url_prefix =
+ cmdline->HasSwitch(switches::kSbInfoURLPrefix) ?
+ cmdline->GetSwitchValueASCII(switches::kSbInfoURLPrefix) :
+ kSbDefaultInfoURLPrefix;
+ std::string mackey_url_prefix =
+ cmdline->HasSwitch(switches::kSbMacKeyURLPrefix) ?
+ cmdline->GetSwitchValueASCII(switches::kSbMacKeyURLPrefix) :
+ kSbDefaultMacKeyURLPrefix;
protocol_manager_ = new SafeBrowsingProtocolManager(this,
client_name,
client_key,
wrapped_key,
- request_context_getter);
+ request_context_getter,
+ info_url_prefix,
+ mackey_url_prefix,
+ disable_auto_update);
// Balance the reference added by Start().
request_context_getter->Release();
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698