| 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/local_database_manager.h" | 5 #include "chrome/browser/safe_browsing/local_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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 // We should have already been shut down. If we're still enabled, then the | 308 // We should have already been shut down. If we're still enabled, then the |
| 309 // database isn't going to be closed properly, which could lead to corruption. | 309 // database isn't going to be closed properly, which could lead to corruption. |
| 310 DCHECK(!enabled_); | 310 DCHECK(!enabled_); |
| 311 } | 311 } |
| 312 | 312 |
| 313 bool LocalSafeBrowsingDatabaseManager::IsSupported() const { | 313 bool LocalSafeBrowsingDatabaseManager::IsSupported() const { |
| 314 return true; | 314 return true; |
| 315 } | 315 } |
| 316 | 316 |
| 317 bool LocalSafeBrowsingDatabaseManager::ChecksAreAlwaysAsync() const { |
| 318 return false; |
| 319 } |
| 320 |
| 321 bool LocalSafeBrowsingDatabaseManager::CanCheckResourceType( |
| 322 content::ResourceType resource_type) const { |
| 323 // We check all types since most checks are fast. |
| 324 return true; |
| 325 } |
| 326 |
| 317 bool LocalSafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { | 327 bool LocalSafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { |
| 318 return url.SchemeIs(url::kFtpScheme) || | 328 return url.SchemeIs(url::kFtpScheme) || |
| 319 url.SchemeIs(url::kHttpScheme) || | 329 url.SchemeIs(url::kHttpScheme) || |
| 320 url.SchemeIs(url::kHttpsScheme); | 330 url.SchemeIs(url::kHttpsScheme); |
| 321 } | 331 } |
| 322 | 332 |
| 323 bool LocalSafeBrowsingDatabaseManager::CheckDownloadUrl( | 333 bool LocalSafeBrowsingDatabaseManager::CheckDownloadUrl( |
| 324 const std::vector<GURL>& url_chain, | 334 const std::vector<GURL>& url_chain, |
| 325 Client* client) { | 335 Client* client) { |
| 326 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 336 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 check->weak_ptr_factory_->GetWeakPtr(), check)); | 1186 check->weak_ptr_factory_->GetWeakPtr(), check)); |
| 1177 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1187 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1178 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1188 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
| 1179 check->weak_ptr_factory_->GetWeakPtr(), check), | 1189 check->weak_ptr_factory_->GetWeakPtr(), check), |
| 1180 check_timeout_); | 1190 check_timeout_); |
| 1181 } | 1191 } |
| 1182 | 1192 |
| 1183 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { | 1193 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { |
| 1184 return enable_download_protection_; | 1194 return enable_download_protection_; |
| 1185 } | 1195 } |
| OLD | NEW |