| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 browse_prefix_set_.reset(); | 654 browse_prefix_set_.reset(); |
| 655 side_effect_free_whitelist_prefix_set_.reset(); | 655 side_effect_free_whitelist_prefix_set_.reset(); |
| 656 ip_blacklist_.clear(); | 656 ip_blacklist_.clear(); |
| 657 } | 657 } |
| 658 // Wants to acquire the lock itself. | 658 // Wants to acquire the lock itself. |
| 659 WhitelistEverything(&csd_whitelist_); | 659 WhitelistEverything(&csd_whitelist_); |
| 660 WhitelistEverything(&download_whitelist_); | 660 WhitelistEverything(&download_whitelist_); |
| 661 return true; | 661 return true; |
| 662 } | 662 } |
| 663 | 663 |
| 664 // TODO(lzheng): Remove matching_list, it is not used anywhere. | |
| 665 bool SafeBrowsingDatabaseNew::ContainsBrowseUrl( | 664 bool SafeBrowsingDatabaseNew::ContainsBrowseUrl( |
| 666 const GURL& url, | 665 const GURL& url, |
| 667 std::string* matching_list, | |
| 668 std::vector<SBPrefix>* prefix_hits, | 666 std::vector<SBPrefix>* prefix_hits, |
| 669 std::vector<SBFullHashResult>* full_hits, | 667 std::vector<SBFullHashResult>* full_hits, |
| 670 base::Time last_update) { | 668 base::Time last_update) { |
| 671 // Clear the results first. | 669 // Clear the results first. |
| 672 matching_list->clear(); | |
| 673 prefix_hits->clear(); | 670 prefix_hits->clear(); |
| 674 full_hits->clear(); | 671 full_hits->clear(); |
| 675 | 672 |
| 676 std::vector<SBFullHash> full_hashes; | 673 std::vector<SBFullHash> full_hashes; |
| 677 BrowseFullHashesToCheck(url, false, &full_hashes); | 674 BrowseFullHashesToCheck(url, false, &full_hashes); |
| 678 if (full_hashes.empty()) | 675 if (full_hashes.empty()) |
| 679 return false; | 676 return false; |
| 680 | 677 |
| 681 // This function is called on the I/O thread, prevent changes to | 678 // This function is called on the I/O thread, prevent changes to |
| 682 // filter and caches. | 679 // filter and caches. |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 base::AutoLock locked(lookup_lock_); | 1654 base::AutoLock locked(lookup_lock_); |
| 1658 ip_blacklist_.swap(new_blacklist); | 1655 ip_blacklist_.swap(new_blacklist); |
| 1659 } | 1656 } |
| 1660 | 1657 |
| 1661 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { | 1658 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { |
| 1662 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); | 1659 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); |
| 1663 std::vector<SBFullHash> full_hashes; | 1660 std::vector<SBFullHash> full_hashes; |
| 1664 full_hashes.push_back(malware_kill_switch); | 1661 full_hashes.push_back(malware_kill_switch); |
| 1665 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); | 1662 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); |
| 1666 } | 1663 } |
| OLD | NEW |