| 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/safe_browsing_database.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 441 |
| 442 // static | 442 // static |
| 443 void SafeBrowsingDatabase::RecordFailure(FailureType failure_type) { | 443 void SafeBrowsingDatabase::RecordFailure(FailureType failure_type) { |
| 444 UMA_HISTOGRAM_ENUMERATION("SB2.DatabaseFailure", failure_type, | 444 UMA_HISTOGRAM_ENUMERATION("SB2.DatabaseFailure", failure_type, |
| 445 FAILURE_DATABASE_MAX); | 445 FAILURE_DATABASE_MAX); |
| 446 } | 446 } |
| 447 | 447 |
| 448 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew() | 448 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew() |
| 449 : creation_loop_(base::MessageLoop::current()), | 449 : creation_loop_(base::MessageLoop::current()), |
| 450 browse_store_(new SafeBrowsingStoreFile), | 450 browse_store_(new SafeBrowsingStoreFile), |
| 451 reset_factory_(this), | |
| 452 corruption_detected_(false), | 451 corruption_detected_(false), |
| 453 change_detected_(false) { | 452 change_detected_(false), |
| 453 reset_factory_(this) { |
| 454 DCHECK(browse_store_.get()); | 454 DCHECK(browse_store_.get()); |
| 455 DCHECK(!download_store_.get()); | 455 DCHECK(!download_store_.get()); |
| 456 DCHECK(!csd_whitelist_store_.get()); | 456 DCHECK(!csd_whitelist_store_.get()); |
| 457 DCHECK(!download_whitelist_store_.get()); | 457 DCHECK(!download_whitelist_store_.get()); |
| 458 DCHECK(!extension_blacklist_store_.get()); | 458 DCHECK(!extension_blacklist_store_.get()); |
| 459 DCHECK(!side_effect_free_whitelist_store_.get()); | 459 DCHECK(!side_effect_free_whitelist_store_.get()); |
| 460 DCHECK(!ip_blacklist_store_.get()); | 460 DCHECK(!ip_blacklist_store_.get()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew( | 463 SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew( |
| 464 SafeBrowsingStore* browse_store, | 464 SafeBrowsingStore* browse_store, |
| 465 SafeBrowsingStore* download_store, | 465 SafeBrowsingStore* download_store, |
| 466 SafeBrowsingStore* csd_whitelist_store, | 466 SafeBrowsingStore* csd_whitelist_store, |
| 467 SafeBrowsingStore* download_whitelist_store, | 467 SafeBrowsingStore* download_whitelist_store, |
| 468 SafeBrowsingStore* extension_blacklist_store, | 468 SafeBrowsingStore* extension_blacklist_store, |
| 469 SafeBrowsingStore* side_effect_free_whitelist_store, | 469 SafeBrowsingStore* side_effect_free_whitelist_store, |
| 470 SafeBrowsingStore* ip_blacklist_store) | 470 SafeBrowsingStore* ip_blacklist_store) |
| 471 : creation_loop_(base::MessageLoop::current()), | 471 : creation_loop_(base::MessageLoop::current()), |
| 472 browse_store_(browse_store), | 472 browse_store_(browse_store), |
| 473 download_store_(download_store), | 473 download_store_(download_store), |
| 474 csd_whitelist_store_(csd_whitelist_store), | 474 csd_whitelist_store_(csd_whitelist_store), |
| 475 download_whitelist_store_(download_whitelist_store), | 475 download_whitelist_store_(download_whitelist_store), |
| 476 extension_blacklist_store_(extension_blacklist_store), | 476 extension_blacklist_store_(extension_blacklist_store), |
| 477 side_effect_free_whitelist_store_(side_effect_free_whitelist_store), | 477 side_effect_free_whitelist_store_(side_effect_free_whitelist_store), |
| 478 ip_blacklist_store_(ip_blacklist_store), | 478 ip_blacklist_store_(ip_blacklist_store), |
| 479 reset_factory_(this), | 479 corruption_detected_(false), |
| 480 corruption_detected_(false) { | 480 reset_factory_(this) { |
| 481 DCHECK(browse_store_.get()); | 481 DCHECK(browse_store_.get()); |
| 482 } | 482 } |
| 483 | 483 |
| 484 SafeBrowsingDatabaseNew::~SafeBrowsingDatabaseNew() { | 484 SafeBrowsingDatabaseNew::~SafeBrowsingDatabaseNew() { |
| 485 // The DCHECK is disabled due to crbug.com/338486 . | 485 // The DCHECK is disabled due to crbug.com/338486 . |
| 486 // DCHECK_EQ(creation_loop_, base::MessageLoop::current()); | 486 // DCHECK_EQ(creation_loop_, base::MessageLoop::current()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void SafeBrowsingDatabaseNew::Init(const base::FilePath& filename_base) { | 489 void SafeBrowsingDatabaseNew::Init(const base::FilePath& filename_base) { |
| 490 DCHECK_EQ(creation_loop_, base::MessageLoop::current()); | 490 DCHECK_EQ(creation_loop_, base::MessageLoop::current()); |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { | 1567 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { |
| 1568 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); | 1568 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); |
| 1569 std::vector<SBFullHash> full_hashes; | 1569 std::vector<SBFullHash> full_hashes; |
| 1570 full_hashes.push_back(malware_kill_switch); | 1570 full_hashes.push_back(malware_kill_switch); |
| 1571 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); | 1571 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { | 1574 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { |
| 1575 return csd_whitelist_.second; | 1575 return csd_whitelist_.second; |
| 1576 } | 1576 } |
| OLD | NEW |