OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 | 297 |
298 bool SafeBrowsingService::MatchDownloadWhitelistUrl(const GURL& url) { | 298 bool SafeBrowsingService::MatchDownloadWhitelistUrl(const GURL& url) { |
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
300 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) { | 300 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) { |
301 return true; | 301 return true; |
302 } | 302 } |
303 return database_->ContainsDownloadWhitelistedUrl(url); | 303 return database_->ContainsDownloadWhitelistedUrl(url); |
304 } | 304 } |
305 | 305 |
| 306 bool SafeBrowsingService::MatchDownloadWhitelistString( |
| 307 const std::string& str) { |
| 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 309 if (!enabled_ || !enable_download_whitelist_ || !MakeDatabaseAvailable()) { |
| 310 return true; |
| 311 } |
| 312 return database_->ContainsDownloadWhitelistedString(str); |
| 313 } |
| 314 |
306 bool SafeBrowsingService::CheckBrowseUrl(const GURL& url, | 315 bool SafeBrowsingService::CheckBrowseUrl(const GURL& url, |
307 Client* client) { | 316 Client* client) { |
308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
309 if (!enabled_) | 318 if (!enabled_) |
310 return true; | 319 return true; |
311 | 320 |
312 if (!CanCheckUrl(url)) | 321 if (!CanCheckUrl(url)) |
313 return true; | 322 return true; |
314 | 323 |
315 const base::TimeTicks start = base::TimeTicks::Now(); | 324 const base::TimeTicks start = base::TimeTicks::Now(); |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 Stop(); | 1351 Stop(); |
1343 | 1352 |
1344 if (csd_service_.get()) | 1353 if (csd_service_.get()) |
1345 csd_service_->SetEnabledAndRefreshState(enable); | 1354 csd_service_->SetEnabledAndRefreshState(enable); |
1346 if (download_service_.get()) { | 1355 if (download_service_.get()) { |
1347 download_service_->SetEnabled( | 1356 download_service_->SetEnabled( |
1348 enable && !CommandLine::ForCurrentProcess()->HasSwitch( | 1357 enable && !CommandLine::ForCurrentProcess()->HasSwitch( |
1349 switches::kDisableImprovedDownloadProtection)); | 1358 switches::kDisableImprovedDownloadProtection)); |
1350 } | 1359 } |
1351 } | 1360 } |
OLD | NEW |