| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class SafeBrowsingDatabase; | 30 class SafeBrowsingDatabase; |
| 31 | 31 |
| 32 // Factory for creating SafeBrowsingDatabase. Tests implement this factory | 32 // Factory for creating SafeBrowsingDatabase. Tests implement this factory |
| 33 // to create fake Databases for testing. | 33 // to create fake Databases for testing. |
| 34 class SafeBrowsingDatabaseFactory { | 34 class SafeBrowsingDatabaseFactory { |
| 35 public: | 35 public: |
| 36 SafeBrowsingDatabaseFactory() { } | 36 SafeBrowsingDatabaseFactory() { } |
| 37 virtual ~SafeBrowsingDatabaseFactory() { } | 37 virtual ~SafeBrowsingDatabaseFactory() { } |
| 38 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( | 38 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( |
| 39 bool enable_download_protection, | 39 bool enable_download_protection, |
| 40 bool enable_client_side_whitelist) = 0; | 40 bool enable_client_side_whitelist, |
| 41 bool enable_download_whitelist) = 0; |
| 41 private: | 42 private: |
| 42 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseFactory); | 43 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseFactory); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 | 46 |
| 46 // Encapsulates on-disk databases that for safebrowsing. There are | 47 // Encapsulates on-disk databases that for safebrowsing. There are |
| 47 // three databases: browse, download and client-side detection (csd) | 48 // four databases: browse, download, download whitelist and |
| 48 // whitelist databases. The browse database contains information | 49 // client-side detection (csd) whitelist databases. The browse database contains |
| 49 // about phishing and malware urls. The download database contains | 50 // information about phishing and malware urls. The download database contains |
| 50 // URLs for bad binaries (e.g: those containing virus) and hash of | 51 // URLs for bad binaries (e.g: those containing virus) and hash of |
| 51 // these downloaded contents. The csd whitelist database contains URLs | 52 // these downloaded contents. The download whitelist contains whitelisted |
| 52 // that will never be considered as phishing by the client-side | 53 // download hosting sites as well as whitelisted binary signing certificates |
| 53 // phishing detection. These on-disk databases are shared among all | 54 // etc. The csd whitelist database contains URLs that will never be considered |
| 54 // profiles, as it doesn't contain user-specific data. This object is | 55 // as phishing by the client-side phishing detection. These on-disk databases |
| 55 // not thread-safe, i.e. all its methods should be used on the same | 56 // are shared among all profiles, as it doesn't contain user-specific data. This |
| 57 // object is not thread-safe, i.e. all its methods should be used on the same |
| 56 // thread that it was created on. | 58 // thread that it was created on. |
| 57 class SafeBrowsingDatabase { | 59 class SafeBrowsingDatabase { |
| 58 public: | 60 public: |
| 59 // Factory method for obtaining a SafeBrowsingDatabase implementation. | 61 // Factory method for obtaining a SafeBrowsingDatabase implementation. |
| 60 // It is not thread safe. | 62 // It is not thread safe. |
| 61 // |enable_download_protection| is used to control the download database | 63 // |enable_download_protection| is used to control the download database |
| 62 // feature. | 64 // feature. |
| 63 // |enable_client_side_whitelist| is used to control the csd whitelist | 65 // |enable_client_side_whitelist| is used to control the csd whitelist |
| 64 // database feature. | 66 // database feature. |
| 67 // |enable_download_whitelist| is used to control the download whitelist |
| 68 // database feature. |
| 65 static SafeBrowsingDatabase* Create(bool enable_download_protection, | 69 static SafeBrowsingDatabase* Create(bool enable_download_protection, |
| 66 bool enable_client_side_whitelist); | 70 bool enable_client_side_whitelist, |
| 71 bool enable_download_whitelist); |
| 67 | 72 |
| 68 // Makes the passed |factory| the factory used to instantiate | 73 // Makes the passed |factory| the factory used to instantiate |
| 69 // a SafeBrowsingDatabase. This is used for tests. | 74 // a SafeBrowsingDatabase. This is used for tests. |
| 70 static void RegisterFactory(SafeBrowsingDatabaseFactory* factory) { | 75 static void RegisterFactory(SafeBrowsingDatabaseFactory* factory) { |
| 71 factory_ = factory; | 76 factory_ = factory; |
| 72 } | 77 } |
| 73 | 78 |
| 74 virtual ~SafeBrowsingDatabase(); | 79 virtual ~SafeBrowsingDatabase(); |
| 75 | 80 |
| 76 // Initializes the database with the given filename. | 81 // Initializes the database with the given filename. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 99 // Returns false if |prefix| is not in Download database. | 104 // Returns false if |prefix| is not in Download database. |
| 100 // This function could ONLY be accessed from creation thread. | 105 // This function could ONLY be accessed from creation thread. |
| 101 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) = 0; | 106 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) = 0; |
| 102 | 107 |
| 103 // Returns false if |url| is not on the client-side phishing detection | 108 // Returns false if |url| is not on the client-side phishing detection |
| 104 // whitelist. Otherwise, this function returns true. Note: the whitelist | 109 // whitelist. Otherwise, this function returns true. Note: the whitelist |
| 105 // only contains full-length hashes so we don't return any prefix hit. | 110 // only contains full-length hashes so we don't return any prefix hit. |
| 106 // This function should only be called from the IO thread. | 111 // This function should only be called from the IO thread. |
| 107 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) = 0; | 112 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) = 0; |
| 108 | 113 |
| 114 // The download whitelist is used for two purposes: a white-domain list of |
| 115 // sites that are considered to host only harmless binaries as well as a |
| 116 // whitelist of arbitrary strings such as hashed certificate authorities that |
| 117 // are considered to be trusted. The two methods below let you lookup |
| 118 // the whitelist either for a URL or an arbitrary string. These methods will |
| 119 // return false if no match is found and true otherwise. |
| 120 // This function could ONLY be accessed from the IO thread. |
| 121 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) = 0; |
| 122 virtual bool ContainsDownloadWhitelistedString(const std::string& str) = 0; |
| 123 |
| 109 // A database transaction should look like: | 124 // A database transaction should look like: |
| 110 // | 125 // |
| 111 // std::vector<SBListChunkRanges> lists; | 126 // std::vector<SBListChunkRanges> lists; |
| 112 // if (db.UpdateStarted(&lists)) { | 127 // if (db.UpdateStarted(&lists)) { |
| 113 // // Do something with |lists|. | 128 // // Do something with |lists|. |
| 114 // | 129 // |
| 115 // // Process add/sub commands. | 130 // // Process add/sub commands. |
| 116 // db.InsertChunks(list_name, chunks); | 131 // db.InsertChunks(list_name, chunks); |
| 117 // | 132 // |
| 118 // // Process adddel/subdel commands. | 133 // // Process adddel/subdel commands. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 147 // Filename for malware and phishing URL database. | 162 // Filename for malware and phishing URL database. |
| 148 static FilePath BrowseDBFilename(const FilePath& db_base_filename); | 163 static FilePath BrowseDBFilename(const FilePath& db_base_filename); |
| 149 | 164 |
| 150 // Filename for download URL and download binary hash database. | 165 // Filename for download URL and download binary hash database. |
| 151 static FilePath DownloadDBFilename(const FilePath& db_base_filename); | 166 static FilePath DownloadDBFilename(const FilePath& db_base_filename); |
| 152 | 167 |
| 153 // Filename for client-side phishing detection whitelist databsae. | 168 // Filename for client-side phishing detection whitelist databsae. |
| 154 static FilePath CsdWhitelistDBFilename( | 169 static FilePath CsdWhitelistDBFilename( |
| 155 const FilePath& csd_whitelist_base_filename); | 170 const FilePath& csd_whitelist_base_filename); |
| 156 | 171 |
| 172 // Filename for download whitelist databsae. |
| 173 static FilePath DownloadWhitelistDBFilename( |
| 174 const FilePath& download_whitelist_base_filename); |
| 175 |
| 157 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE | 176 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE |
| 158 // ORDERING OF THESE VALUES. | 177 // ORDERING OF THESE VALUES. |
| 159 enum FailureType { | 178 enum FailureType { |
| 160 FAILURE_DATABASE_CORRUPT, | 179 FAILURE_DATABASE_CORRUPT, |
| 161 FAILURE_DATABASE_CORRUPT_HANDLER, | 180 FAILURE_DATABASE_CORRUPT_HANDLER, |
| 162 FAILURE_BROWSE_DATABASE_UPDATE_BEGIN, | 181 FAILURE_BROWSE_DATABASE_UPDATE_BEGIN, |
| 163 FAILURE_BROWSE_DATABASE_UPDATE_FINISH, | 182 FAILURE_BROWSE_DATABASE_UPDATE_FINISH, |
| 164 FAILURE_DATABASE_FILTER_MISSING, | 183 FAILURE_DATABASE_FILTER_MISSING, |
| 165 FAILURE_DATABASE_FILTER_READ, | 184 FAILURE_DATABASE_FILTER_READ, |
| 166 FAILURE_DATABASE_FILTER_WRITE, | 185 FAILURE_DATABASE_FILTER_WRITE, |
| 167 FAILURE_DATABASE_FILTER_DELETE, | 186 FAILURE_DATABASE_FILTER_DELETE, |
| 168 FAILURE_DATABASE_STORE_MISSING, | 187 FAILURE_DATABASE_STORE_MISSING, |
| 169 FAILURE_DATABASE_STORE_DELETE, | 188 FAILURE_DATABASE_STORE_DELETE, |
| 170 FAILURE_DOWNLOAD_DATABASE_UPDATE_BEGIN, | 189 FAILURE_DOWNLOAD_DATABASE_UPDATE_BEGIN, |
| 171 FAILURE_DOWNLOAD_DATABASE_UPDATE_FINISH, | 190 FAILURE_DOWNLOAD_DATABASE_UPDATE_FINISH, |
| 172 FAILURE_CSD_WHITELIST_DATABASE_UPDATE_BEGIN, | 191 FAILURE_WHITELIST_DATABASE_UPDATE_BEGIN, |
| 173 FAILURE_CSD_WHITELIST_DATABASE_UPDATE_FINISH, | 192 FAILURE_WHITELIST_DATABASE_UPDATE_FINISH, |
| 174 | |
| 175 // Memory space for histograms is determined by the max. ALWAYS | 193 // Memory space for histograms is determined by the max. ALWAYS |
| 176 // ADD NEW VALUES BEFORE THIS ONE. | 194 // ADD NEW VALUES BEFORE THIS ONE. |
| 177 FAILURE_DATABASE_MAX | 195 FAILURE_DATABASE_MAX |
| 178 }; | 196 }; |
| 179 | 197 |
| 180 static void RecordFailure(FailureType failure_type); | 198 static void RecordFailure(FailureType failure_type); |
| 181 | 199 |
| 182 private: | 200 private: |
| 183 // The factory used to instantiate a SafeBrowsingDatabase object. | 201 // The factory used to instantiate a SafeBrowsingDatabase object. |
| 184 // Useful for tests, so they can provide their own implementation of | 202 // Useful for tests, so they can provide their own implementation of |
| 185 // SafeBrowsingDatabase. | 203 // SafeBrowsingDatabase. |
| 186 static SafeBrowsingDatabaseFactory* factory_; | 204 static SafeBrowsingDatabaseFactory* factory_; |
| 187 }; | 205 }; |
| 188 | 206 |
| 189 class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { | 207 class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { |
| 190 public: | 208 public: |
| 191 // Create a database with a browse store, download store and | 209 // Create a database with a browse, download, download whitelist and |
| 192 // csd_whitelist_store. Takes ownership of browse_store, download_store and | 210 // csd whitelist store objects. Takes ownership of all the store objects. |
| 193 // csd_whitelist_store. When |download_store| is NULL, the database | 211 // When |download_store| is NULL, the database will ignore any operations |
| 194 // will ignore any operations related download (url hashes and | 212 // related download (url hashes and binary hashes). The same is true for |
| 195 // binary hashes). Same for the |csd_whitelist_store|. | 213 // the |csd_whitelist_store| and |download_whitelist_store|. |
| 196 SafeBrowsingDatabaseNew(SafeBrowsingStore* browse_store, | 214 SafeBrowsingDatabaseNew(SafeBrowsingStore* browse_store, |
| 197 SafeBrowsingStore* download_store, | 215 SafeBrowsingStore* download_store, |
| 198 SafeBrowsingStore* csd_whitelist_store); | 216 SafeBrowsingStore* csd_whitelist_store, |
| 217 SafeBrowsingStore* download_whitelist_store); |
| 199 | 218 |
| 200 // Create a database with a browse store. This is a legacy interface that | 219 // Create a database with a browse store. This is a legacy interface that |
| 201 // useds Sqlite. | 220 // useds Sqlite. |
| 202 SafeBrowsingDatabaseNew(); | 221 SafeBrowsingDatabaseNew(); |
| 203 | 222 |
| 204 virtual ~SafeBrowsingDatabaseNew(); | 223 virtual ~SafeBrowsingDatabaseNew(); |
| 205 | 224 |
| 206 // Implement SafeBrowsingDatabase interface. | 225 // Implement SafeBrowsingDatabase interface. |
| 207 virtual void Init(const FilePath& filename); | 226 virtual void Init(const FilePath& filename); |
| 208 virtual bool ResetDatabase(); | 227 virtual bool ResetDatabase(); |
| 209 virtual bool ContainsBrowseUrl(const GURL& url, | 228 virtual bool ContainsBrowseUrl(const GURL& url, |
| 210 std::string* matching_list, | 229 std::string* matching_list, |
| 211 std::vector<SBPrefix>* prefix_hits, | 230 std::vector<SBPrefix>* prefix_hits, |
| 212 std::vector<SBFullHashResult>* full_hits, | 231 std::vector<SBFullHashResult>* full_hits, |
| 213 base::Time last_update); | 232 base::Time last_update); |
| 214 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 233 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
| 215 std::vector<SBPrefix>* prefix_hits); | 234 std::vector<SBPrefix>* prefix_hits); |
| 216 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix); | 235 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix); |
| 217 virtual bool ContainsCsdWhitelistedUrl(const GURL& url); | 236 virtual bool ContainsCsdWhitelistedUrl(const GURL& url); |
| 237 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url); |
| 238 virtual bool ContainsDownloadWhitelistedString(const std::string& str); |
| 218 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists); | 239 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists); |
| 219 virtual void InsertChunks(const std::string& list_name, | 240 virtual void InsertChunks(const std::string& list_name, |
| 220 const SBChunkList& chunks); | 241 const SBChunkList& chunks); |
| 221 virtual void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes); | 242 virtual void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes); |
| 222 virtual void UpdateFinished(bool update_succeeded); | 243 virtual void UpdateFinished(bool update_succeeded); |
| 223 virtual void CacheHashResults(const std::vector<SBPrefix>& prefixes, | 244 virtual void CacheHashResults(const std::vector<SBPrefix>& prefixes, |
| 224 const std::vector<SBFullHashResult>& full_hits); | 245 const std::vector<SBFullHashResult>& full_hits); |
| 225 | 246 |
| 226 private: | 247 private: |
| 227 friend class SafeBrowsingDatabaseTest; | 248 friend class SafeBrowsingDatabaseTest; |
| 228 FRIEND_TEST(SafeBrowsingDatabaseTest, HashCaching); | 249 FRIEND_TEST(SafeBrowsingDatabaseTest, HashCaching); |
| 229 | 250 |
| 230 // Return the browse_store_, download_store_ or csd_whitelist_store_ | 251 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored |
| 231 // based on list_id. | 252 // in a sorted vector) as well as a boolean flag indicating whether all |
| 253 // lookups in the whitelist should be considered matches for safety. |
| 254 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist; |
| 255 |
| 256 // Returns true if the whitelist is disabled or if any of the given hashes |
| 257 // matches the whitelist. |
| 258 bool ContainsWhitelistedHashes(const SBWhitelist& whitelist, |
| 259 const std::vector<SBFullHash>& hashes); |
| 260 |
| 261 // Return the browse_store_, download_store_, download_whitelist_store or |
| 262 // csd_whitelist_store_ based on list_id. |
| 232 SafeBrowsingStore* GetStore(int list_id); | 263 SafeBrowsingStore* GetStore(int list_id); |
| 233 | 264 |
| 234 // Deletes the files on disk. | 265 // Deletes the files on disk. |
| 235 bool Delete(); | 266 bool Delete(); |
| 236 | 267 |
| 237 // Load the bloom filter off disk, or generates one if it doesn't exist. | 268 // Load the bloom filter off disk, or generates one if it doesn't exist. |
| 238 void LoadBloomFilter(); | 269 void LoadBloomFilter(); |
| 239 | 270 |
| 240 // Writes the current bloom filter to disk. | 271 // Writes the current bloom filter to disk. |
| 241 void WriteBloomFilter(); | 272 void WriteBloomFilter(); |
| 242 | 273 |
| 243 // Loads the given full-length hashes to the csd whitelist. If the number | 274 // Loads the given full-length hashes to the given whitelist. If the number |
| 244 // of hashes is too large or if the kill switch URL is on the whitelist | 275 // of hashes is too large or if the kill switch URL is on the whitelist |
| 245 // we will whitelist all URLs. | 276 // we will whitelist everything. |
| 246 void LoadCsdWhitelist(const std::vector<SBAddFullHash>& full_hashes); | 277 void LoadWhitelist(const std::vector<SBAddFullHash>& full_hashes, |
| 278 SBWhitelist* whitelist); |
| 247 | 279 |
| 248 // Call this method if an error occured with the csd whitelist. This will | 280 // Call this method if an error occured with the given whitelist. This will |
| 249 // result in all calls to ContainsCsdWhitelistedUrl() to returning true. | 281 // result in all lookups to the whitelist to return true. |
| 250 void CsdWhitelistAllUrls(); | 282 void WhitelistEverything(SBWhitelist* whitelist); |
| 251 | 283 |
| 252 // Helpers for handling database corruption. | 284 // Helpers for handling database corruption. |
| 253 // |OnHandleCorruptDatabase()| runs |ResetDatabase()| and sets | 285 // |OnHandleCorruptDatabase()| runs |ResetDatabase()| and sets |
| 254 // |corruption_detected_|, |HandleCorruptDatabase()| posts | 286 // |corruption_detected_|, |HandleCorruptDatabase()| posts |
| 255 // |OnHandleCorruptDatabase()| to the current thread, to be run | 287 // |OnHandleCorruptDatabase()| to the current thread, to be run |
| 256 // after the current task completes. | 288 // after the current task completes. |
| 257 // TODO(shess): Wire things up to entirely abort the update | 289 // TODO(shess): Wire things up to entirely abort the update |
| 258 // transaction when this happens. | 290 // transaction when this happens. |
| 259 void HandleCorruptDatabase(); | 291 void HandleCorruptDatabase(); |
| 260 void OnHandleCorruptDatabase(); | 292 void OnHandleCorruptDatabase(); |
| 261 | 293 |
| 262 // Helpers for InsertChunks(). | 294 // Helpers for InsertChunks(). |
| 263 void InsertAdd(int chunk, SBPrefix host, const SBEntry* entry, int list_id); | 295 void InsertAdd(int chunk, SBPrefix host, const SBEntry* entry, int list_id); |
| 264 void InsertAddChunks(int list_id, const SBChunkList& chunks); | 296 void InsertAddChunks(int list_id, const SBChunkList& chunks); |
| 265 void InsertSub(int chunk, SBPrefix host, const SBEntry* entry, int list_id); | 297 void InsertSub(int chunk, SBPrefix host, const SBEntry* entry, int list_id); |
| 266 void InsertSubChunks(int list_id, const SBChunkList& chunks); | 298 void InsertSubChunks(int list_id, const SBChunkList& chunks); |
| 267 | 299 |
| 268 void UpdateDownloadStore(); | 300 void UpdateDownloadStore(); |
| 269 void UpdateBrowseStore(); | 301 void UpdateBrowseStore(); |
| 270 void UpdateCsdWhitelistStore(); | 302 void UpdateWhitelistStore(const FilePath& store_filename, |
| 303 SafeBrowsingStore* store, |
| 304 SBWhitelist* whitelist); |
| 271 | 305 |
| 272 // Helper function to compare addprefixes in download_store_ with |prefixes|. | 306 // Helper function to compare addprefixes in download_store_ with |prefixes|. |
| 273 // The |list_bit| indicates which list (download url or download hash) | 307 // The |list_bit| indicates which list (download url or download hash) |
| 274 // to compare. | 308 // to compare. |
| 275 // Returns true if there is a match, |*prefix_hits| will contain the actual | 309 // Returns true if there is a match, |*prefix_hits| will contain the actual |
| 276 // matching prefixes. | 310 // matching prefixes. |
| 277 bool MatchDownloadAddPrefixes(int list_bit, | 311 bool MatchDownloadAddPrefixes(int list_bit, |
| 278 const std::vector<SBPrefix>& prefixes, | 312 const std::vector<SBPrefix>& prefixes, |
| 279 std::vector<SBPrefix>* prefix_hits); | 313 std::vector<SBPrefix>* prefix_hits); |
| 280 | 314 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 295 | 329 |
| 296 // For download related (download URL and binary hash) chunks and prefixes. | 330 // For download related (download URL and binary hash) chunks and prefixes. |
| 297 FilePath download_filename_; | 331 FilePath download_filename_; |
| 298 scoped_ptr<SafeBrowsingStore> download_store_; | 332 scoped_ptr<SafeBrowsingStore> download_store_; |
| 299 | 333 |
| 300 // For the client-side phishing detection whitelist chunks and full-length | 334 // For the client-side phishing detection whitelist chunks and full-length |
| 301 // hashes. This list only contains 256 bit hashes. | 335 // hashes. This list only contains 256 bit hashes. |
| 302 FilePath csd_whitelist_filename_; | 336 FilePath csd_whitelist_filename_; |
| 303 scoped_ptr<SafeBrowsingStore> csd_whitelist_store_; | 337 scoped_ptr<SafeBrowsingStore> csd_whitelist_store_; |
| 304 | 338 |
| 305 // All the client-side phishing detection whitelist entries are loaded in | 339 // For the download whitelist chunks and full-length hashes. This list only |
| 306 // a sorted vector. | 340 // contains 256 bit hashes. |
| 307 std::vector<SBFullHash> csd_whitelist_; | 341 FilePath download_whitelist_filename_; |
| 342 scoped_ptr<SafeBrowsingStore> download_whitelist_store_; |
| 308 | 343 |
| 309 // If true, ContainsCsdWhitelistedUrl will always return true for all URLs. | 344 SBWhitelist csd_whitelist_; |
| 310 // This is set to true if the csd whitelist is too large to be stored in | 345 SBWhitelist download_whitelist_; |
| 311 // memory, if the kill switch URL is on the csd whitelist or if there was | |
| 312 // an error during the most recent update. | |
| 313 bool csd_whitelist_all_urls_; | |
| 314 | 346 |
| 315 // Bloom filter generated from the add-prefixes in |browse_store_|. | 347 // Bloom filter generated from the add-prefixes in |browse_store_|. |
| 316 // Only browse_store_ requires the BloomFilter for fast query. | 348 // Only browse_store_ requires the BloomFilter for fast query. |
| 317 FilePath bloom_filter_filename_; | 349 FilePath bloom_filter_filename_; |
| 318 scoped_refptr<BloomFilter> browse_bloom_filter_; | 350 scoped_refptr<BloomFilter> browse_bloom_filter_; |
| 319 | 351 |
| 320 // Cached browse store related full-hash items, ordered by prefix for | 352 // Cached browse store related full-hash items, ordered by prefix for |
| 321 // efficient scanning. | 353 // efficient scanning. |
| 322 // |full_browse_hashes_| are items from |browse_store_|, | 354 // |full_browse_hashes_| are items from |browse_store_|, |
| 323 // |pending_browse_hashes_| are items from |CacheHashResults()|, which | 355 // |pending_browse_hashes_| are items from |CacheHashResults()|, which |
| (...skipping 16 matching lines...) Expand all Loading... |
| 340 | 372 |
| 341 // Set to true if any chunks are added or deleted during an update. | 373 // Set to true if any chunks are added or deleted during an update. |
| 342 // Used to optimize away database update. | 374 // Used to optimize away database update. |
| 343 bool change_detected_; | 375 bool change_detected_; |
| 344 | 376 |
| 345 // Used to check if a prefix was in the database. | 377 // Used to check if a prefix was in the database. |
| 346 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; | 378 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; |
| 347 }; | 379 }; |
| 348 | 380 |
| 349 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 381 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| OLD | NEW |