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

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

Issue 5544008: Add a browser test for safebrowsing service.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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
Index: chrome/browser/safe_browsing/protocol_manager.cc
===================================================================
--- chrome/browser/safe_browsing/protocol_manager.cc (revision 69048)
+++ chrome/browser/safe_browsing/protocol_manager.cc (working copy)
@@ -37,9 +37,53 @@
// Maximum back off multiplier.
static const int kSbMaxBackOff = 8;
+// The default SBProtocolManagerFactory.
+class SBProtocolManagerFactoryImpl : public SBProtocolManagerFactory {
+ public:
+ SBProtocolManagerFactoryImpl() { }
+ virtual ~SBProtocolManagerFactoryImpl() { }
+ virtual SafeBrowsingProtocolManager* CreateProtocolManager(
+ SafeBrowsingService* sb_service,
+ const std::string& client_name,
+ const std::string& client_key,
+ const std::string& wrapped_key,
+ URLRequestContextGetter* request_context_getter,
+ const std::string& info_url_prefix,
+ const std::string& mackey_url_prefix,
+ bool disable_auto_update) {
+ return new SafeBrowsingProtocolManager(
+ sb_service, client_name, client_key, wrapped_key,
+ request_context_getter, info_url_prefix, mackey_url_prefix,
+ disable_auto_update);
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SBProtocolManagerFactoryImpl);
+};
// SafeBrowsingProtocolManager implementation ----------------------------------
+// static
+SBProtocolManagerFactory* SafeBrowsingProtocolManager::factory_ = NULL;
+
+// static
+SafeBrowsingProtocolManager* SafeBrowsingProtocolManager::Create(
+ SafeBrowsingService* sb_service,
+ const std::string& client_name,
+ const std::string& client_key,
+ const std::string& wrapped_key,
+ URLRequestContextGetter* request_context_getter,
+ const std::string& info_url_prefix,
+ const std::string& mackey_url_prefix,
+ bool disable_auto_update) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (!factory_)
+ factory_ = new SBProtocolManagerFactoryImpl();
+ return factory_->CreateProtocolManager(sb_service, client_name, client_key,
+ wrapped_key, request_context_getter,
+ info_url_prefix, mackey_url_prefix,
+ disable_auto_update);
+}
+
SafeBrowsingProtocolManager::SafeBrowsingProtocolManager(
SafeBrowsingService* sb_service,
const std::string& client_name,
@@ -206,11 +250,11 @@
} else {
HandleGetHashError(Time::Now());
if (status.status() == URLRequestStatus::FAILED) {
- VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
- << " failed with os error: " << status.os_error();
+ VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
+ << " failed with os error: " << status.os_error();
} else {
- VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
- << " failed with error: " << response_code;
+ VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
+ << " failed with error: " << response_code;
}
}
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('k') | chrome/browser/safe_browsing/safe_browsing_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698