| OLD | NEW |
| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 bool SafeBrowsingDatabaseManager::MatchDownloadWhitelistString( | 301 bool SafeBrowsingDatabaseManager::MatchDownloadWhitelistString( |
| 302 const std::string& str) { | 302 const std::string& str) { |
| 303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 304 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) { | 304 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) { |
| 305 return true; | 305 return true; |
| 306 } | 306 } |
| 307 return database_->ContainsDownloadWhitelistedString(str); | 307 return database_->ContainsDownloadWhitelistedString(str); |
| 308 } | 308 } |
| 309 | 309 |
| 310 bool SafeBrowsingDatabaseManager::MalwareKillSwitchOn() { |
| 311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 312 if (!enabled_ || !MakeDatabaseAvailable()) { |
| 313 return true; |
| 314 } |
| 315 return database_->MalwareIPMatchKillSwitchOn(); |
| 316 } |
| 317 |
| 310 bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url, | 318 bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url, |
| 311 Client* client) { | 319 Client* client) { |
| 312 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 313 if (!enabled_) | 321 if (!enabled_) |
| 314 return true; | 322 return true; |
| 315 | 323 |
| 316 if (!CanCheckUrl(url)) | 324 if (!CanCheckUrl(url)) |
| 317 return true; | 325 return true; |
| 318 | 326 |
| 319 const base::TimeTicks start = base::TimeTicks::Now(); | 327 const base::TimeTicks start = base::TimeTicks::Now(); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); | 1057 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); |
| 1050 checks_.insert(check); | 1058 checks_.insert(check); |
| 1051 | 1059 |
| 1052 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); | 1060 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); |
| 1053 | 1061 |
| 1054 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1062 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 1055 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1063 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
| 1056 check->timeout_factory_->GetWeakPtr(), check), | 1064 check->timeout_factory_->GetWeakPtr(), check), |
| 1057 check_timeout_); | 1065 check_timeout_); |
| 1058 } | 1066 } |
| OLD | NEW |