| Index: components/safe_browsing_db/database_manager.cc
|
| diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing_db/database_manager.cc
|
| index 91e4d7b6bbdbb1c6d2c893e95d81312c7453d357..1f0579ba5087f61e1d6441ad4517b9dcc4e79017 100644
|
| --- a/components/safe_browsing_db/database_manager.cc
|
| +++ b/components/safe_browsing_db/database_manager.cc
|
| @@ -15,7 +15,7 @@ using content::BrowserThread;
|
|
|
| namespace safe_browsing {
|
|
|
| -SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager() {}
|
| +SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager() : enabled_(false) {}
|
|
|
| SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() {
|
| DCHECK(!v4_get_hash_protocol_manager_);
|
| @@ -37,8 +37,9 @@ bool SafeBrowsingDatabaseManager::CheckApiBlacklistUrl(const GURL& url,
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| DCHECK(v4_get_hash_protocol_manager_);
|
|
|
| - // Make sure we can check this url.
|
| - if (!(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme))) {
|
| + // Make sure we can check this url and that the service is enabled.
|
| + if (!enabled_ ||
|
| + !(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme))) {
|
| return true;
|
| }
|
|
|
| @@ -94,6 +95,8 @@ void SafeBrowsingDatabaseManager::StartOnIOThread(
|
|
|
| v4_get_hash_protocol_manager_ = V4GetHashProtocolManager::Create(
|
| request_context_getter, GetStoresForFullHashRequests(), config);
|
| +
|
| + enabled_ = true;
|
| }
|
|
|
| // |shutdown| not used. Destroys the v4 protocol managers. This may be called
|
| @@ -102,6 +105,8 @@ void SafeBrowsingDatabaseManager::StartOnIOThread(
|
| void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
|
| + enabled_ = false;
|
| +
|
| // Delete pending checks, calling back any clients with empty metadata.
|
| for (const SafeBrowsingApiCheck* check : api_checks_) {
|
| if (check->client()) {
|
|
|