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

Side by Side Diff: chrome/browser/safe_browsing/database_manager.cc

Issue 14999008: Add a killswitch for CSD malware IP match and report feature. Use a new killswitch whitelist URL wh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment and add unittest Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/safe_browsing/database_manager.h" 5 #include "chrome/browser/safe_browsing/database_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 bool SafeBrowsingDatabaseManager::MatchDownloadWhitelistString( 270 bool SafeBrowsingDatabaseManager::MatchDownloadWhitelistString(
271 const std::string& str) { 271 const std::string& str) {
272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
273 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) { 273 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) {
274 return true; 274 return true;
275 } 275 }
276 return database_->ContainsDownloadWhitelistedString(str); 276 return database_->ContainsDownloadWhitelistedString(str);
277 } 277 }
278 278
279 bool SafeBrowsingDatabaseManager::MalwareKillSwitchOn() {
280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
281 if (!enabled_ || !MakeDatabaseAvailable()) {
282 return true;
283 }
284 return database_->MalwareIPMatchKillSwitchOn();
285 }
286
279 bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url, 287 bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url,
280 Client* client) { 288 Client* client) {
281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
282 if (!enabled_) 290 if (!enabled_)
283 return true; 291 return true;
284 292
285 if (!CanCheckUrl(url)) 293 if (!CanCheckUrl(url))
286 return true; 294 return true;
287 295
288 const base::TimeTicks start = base::TimeTicks::Now(); 296 const base::TimeTicks start = base::TimeTicks::Now();
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); 1014 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this));
1007 checks_.insert(check); 1015 checks_.insert(check);
1008 1016
1009 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1017 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1010 1018
1011 MessageLoop::current()->PostDelayedTask(FROM_HERE, 1019 MessageLoop::current()->PostDelayedTask(FROM_HERE,
1012 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, 1020 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback,
1013 check->timeout_factory_->GetWeakPtr(), check), 1021 check->timeout_factory_->GetWeakPtr(), check),
1014 check_timeout_); 1022 check_timeout_);
1015 } 1023 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698