| 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 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 // Delete pending checks, calling back any clients with 'SB_THREAT_TYPE_SAFE'. | 766 // Delete pending checks, calling back any clients with 'SB_THREAT_TYPE_SAFE'. |
| 767 // We have to do this after the db thread returns because methods on it can | 767 // We have to do this after the db thread returns because methods on it can |
| 768 // have copies of these pointers, so deleting them might lead to accessing | 768 // have copies of these pointers, so deleting them might lead to accessing |
| 769 // garbage. | 769 // garbage. |
| 770 for (CurrentChecks::iterator it = checks_.begin(); it != checks_.end(); | 770 for (CurrentChecks::iterator it = checks_.begin(); it != checks_.end(); |
| 771 ++it) { | 771 ++it) { |
| 772 SafeBrowsingCheck* check = *it; | 772 SafeBrowsingCheck* check = *it; |
| 773 if (check->client) | 773 if (check->client) |
| 774 check->OnSafeBrowsingResult(); | 774 check->OnSafeBrowsingResult(); |
| 775 } | 775 } |
| 776 STLDeleteElements(&checks_); | 776 base::STLDeleteElements(&checks_); |
| 777 | 777 |
| 778 gethash_requests_.clear(); | 778 gethash_requests_.clear(); |
| 779 } | 779 } |
| 780 | 780 |
| 781 bool LocalSafeBrowsingDatabaseManager::DatabaseAvailable() const { | 781 bool LocalSafeBrowsingDatabaseManager::DatabaseAvailable() const { |
| 782 base::AutoLock lock(database_lock_); | 782 base::AutoLock lock(database_lock_); |
| 783 return !closing_database_ && (database_ != NULL); | 783 return !closing_database_ && (database_ != NULL); |
| 784 } | 784 } |
| 785 | 785 |
| 786 bool LocalSafeBrowsingDatabaseManager::MakeDatabaseAvailable() { | 786 bool LocalSafeBrowsingDatabaseManager::MakeDatabaseAvailable() { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1240 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
| 1241 check->weak_ptr_factory_->GetWeakPtr(), check), | 1241 check->weak_ptr_factory_->GetWeakPtr(), check), |
| 1242 check_timeout_); | 1242 check_timeout_); |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { | 1245 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { |
| 1246 return enable_download_protection_; | 1246 return enable_download_protection_; |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 } // namespace safe_browsing | 1249 } // namespace safe_browsing |
| OLD | NEW |