| 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();
|
|
|