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