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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Filename suffix for the csd malware IP blacklist store. | 57 // Filename suffix for the csd malware IP blacklist store. |
58 const base::FilePath::CharType kIPBlacklistDBFile[] = | 58 const base::FilePath::CharType kIPBlacklistDBFile[] = |
59 FILE_PATH_LITERAL(" IP Blacklist"); | 59 FILE_PATH_LITERAL(" IP Blacklist"); |
60 | 60 |
61 // Filename suffix for browse store. | 61 // Filename suffix for browse store. |
62 // TODO(shess): "Safe Browsing Bloom Prefix Set" is full of win. | 62 // TODO(shess): "Safe Browsing Bloom Prefix Set" is full of win. |
63 // Unfortunately, to change the name implies lots of transition code | 63 // Unfortunately, to change the name implies lots of transition code |
64 // for little benefit. If/when file formats change (say to put all | 64 // for little benefit. If/when file formats change (say to put all |
65 // the data in one file), that would be a convenient point to rectify | 65 // the data in one file), that would be a convenient point to rectify |
66 // this. | 66 // this. |
| 67 // TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379> |
| 68 #if defined(OS_ANDROID) |
| 69 // NOTE(shess): This difference is also reflected in the list name in |
| 70 // safe_browsing_util.cc. |
| 71 // TODO(shess): Spin up an alternate list id which can be persisted in the |
| 72 // store. Then if a mistake is made, it won't cause confusion between |
| 73 // incompatible lists. |
| 74 const base::FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Mobile"); |
| 75 #else |
67 const base::FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Bloom"); | 76 const base::FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Bloom"); |
| 77 #endif |
68 | 78 |
69 // Maximum number of entries we allow in any of the whitelists. | 79 // Maximum number of entries we allow in any of the whitelists. |
70 // If a whitelist on disk contains more entries then all lookups to | 80 // If a whitelist on disk contains more entries then all lookups to |
71 // the whitelist will be considered a match. | 81 // the whitelist will be considered a match. |
72 const size_t kMaxWhitelistSize = 5000; | 82 const size_t kMaxWhitelistSize = 5000; |
73 | 83 |
74 // If the hash of this exact expression is on a whitelist then all | 84 // If the hash of this exact expression is on a whitelist then all |
75 // lookups to this whitelist will be considered a match. | 85 // lookups to this whitelist will be considered a match. |
76 const char kWhitelistKillSwitchUrl[] = | 86 const char kWhitelistKillSwitchUrl[] = |
77 "sb-ssl.google.com/safebrowsing/csd/killswitch"; // Don't change this! | 87 "sb-ssl.google.com/safebrowsing/csd/killswitch"; // Don't change this! |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { | 1564 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { |
1555 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); | 1565 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); |
1556 std::vector<SBFullHash> full_hashes; | 1566 std::vector<SBFullHash> full_hashes; |
1557 full_hashes.push_back(malware_kill_switch); | 1567 full_hashes.push_back(malware_kill_switch); |
1558 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); | 1568 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); |
1559 } | 1569 } |
1560 | 1570 |
1561 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { | 1571 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { |
1562 return csd_whitelist_.second; | 1572 return csd_whitelist_.second; |
1563 } | 1573 } |
OLD | NEW |