Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database.h

Issue 14999008: Add a killswitch for CSD malware IP match and report feature. Use a new killswitch whitelist URL wh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment, call ContainsWhitelistedHashes to check killswitch Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const std::vector<SBChunkDelete>& chunk_deletes) = 0; 157 const std::vector<SBChunkDelete>& chunk_deletes) = 0;
158 virtual void UpdateFinished(bool update_succeeded) = 0; 158 virtual void UpdateFinished(bool update_succeeded) = 0;
159 159
160 // Store the results of a GetHash response. In the case of empty results, we 160 // Store the results of a GetHash response. In the case of empty results, we
161 // cache the prefixes until the next update so that we don't have to issue 161 // cache the prefixes until the next update so that we don't have to issue
162 // further GetHash requests we know will be empty. 162 // further GetHash requests we know will be empty.
163 virtual void CacheHashResults( 163 virtual void CacheHashResults(
164 const std::vector<SBPrefix>& prefixes, 164 const std::vector<SBPrefix>& prefixes,
165 const std::vector<SBFullHashResult>& full_hits) = 0; 165 const std::vector<SBFullHashResult>& full_hits) = 0;
166 166
167 virtual bool MalwareIPMatchKillSwitchOn() = 0;
168
167 // The name of the bloom-filter file for the given database file. 169 // The name of the bloom-filter file for the given database file.
168 // NOTE(shess): OBSOLETE. Present for deleting stale files. 170 // NOTE(shess): OBSOLETE. Present for deleting stale files.
169 static base::FilePath BloomFilterForFilename( 171 static base::FilePath BloomFilterForFilename(
170 const base::FilePath& db_filename); 172 const base::FilePath& db_filename);
171 173
172 // The name of the prefix set file for the given database file. 174 // The name of the prefix set file for the given database file.
173 static base::FilePath PrefixSetForFilename(const base::FilePath& db_filename); 175 static base::FilePath PrefixSetForFilename(const base::FilePath& db_filename);
174 176
175 // Filename for malware and phishing URL database. 177 // Filename for malware and phishing URL database.
176 static base::FilePath BrowseDBFilename( 178 static base::FilePath BrowseDBFilename(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE; 273 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE;
272 virtual void InsertChunks(const std::string& list_name, 274 virtual void InsertChunks(const std::string& list_name,
273 const SBChunkList& chunks) OVERRIDE; 275 const SBChunkList& chunks) OVERRIDE;
274 virtual void DeleteChunks( 276 virtual void DeleteChunks(
275 const std::vector<SBChunkDelete>& chunk_deletes) OVERRIDE; 277 const std::vector<SBChunkDelete>& chunk_deletes) OVERRIDE;
276 virtual void UpdateFinished(bool update_succeeded) OVERRIDE; 278 virtual void UpdateFinished(bool update_succeeded) OVERRIDE;
277 virtual void CacheHashResults( 279 virtual void CacheHashResults(
278 const std::vector<SBPrefix>& prefixes, 280 const std::vector<SBPrefix>& prefixes,
279 const std::vector<SBFullHashResult>& full_hits) OVERRIDE; 281 const std::vector<SBFullHashResult>& full_hits) OVERRIDE;
280 282
283 // Returns the value of malware_kill_switch_;
284 virtual bool MalwareIPMatchKillSwitchOn() OVERRIDE;
285
281 private: 286 private:
282 friend class SafeBrowsingDatabaseTest; 287 friend class SafeBrowsingDatabaseTest;
283 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, HashCaching); 288 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, HashCaching);
284 289
285 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored 290 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored
286 // in a sorted vector) as well as a boolean flag indicating whether all 291 // in a sorted vector) as well as a boolean flag indicating whether all
287 // lookups in the whitelist should be considered matches for safety. 292 // lookups in the whitelist should be considered matches for safety.
288 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist; 293 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist;
289 294
290 // Returns true if the whitelist is disabled or if any of the given hashes 295 // Returns true if the whitelist is disabled or if any of the given hashes
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 SafeBrowsingStore* store, 347 SafeBrowsingStore* store,
343 SBWhitelist* whitelist); 348 SBWhitelist* whitelist);
344 349
345 // Used to verify that various calls are made from the thread the 350 // Used to verify that various calls are made from the thread the
346 // object was created on. 351 // object was created on.
347 base::MessageLoop* creation_loop_; 352 base::MessageLoop* creation_loop_;
348 353
349 // Lock for protecting access to variables that may be used on the 354 // Lock for protecting access to variables that may be used on the
350 // IO thread. This includes |prefix_set_|, |full_browse_hashes_|, 355 // IO thread. This includes |prefix_set_|, |full_browse_hashes_|,
351 // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|, 356 // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|,
352 // and |csd_whitelist_all_urls_|. 357 // and |malware_kill_switch_|.
mattm 2013/05/23 06:59:41 update comment
kewang 2013/05/23 08:22:33 Done.
353 base::Lock lookup_lock_; 358 base::Lock lookup_lock_;
354 359
355 // Underlying persistent store for chunk data. 360 // Underlying persistent store for chunk data.
356 // For browsing related (phishing and malware URLs) chunks and prefixes. 361 // For browsing related (phishing and malware URLs) chunks and prefixes.
357 base::FilePath browse_filename_; 362 base::FilePath browse_filename_;
358 scoped_ptr<SafeBrowsingStore> browse_store_; 363 scoped_ptr<SafeBrowsingStore> browse_store_;
359 364
360 // For download related (download URL and binary hash) chunks and prefixes. 365 // For download related (download URL and binary hash) chunks and prefixes.
361 base::FilePath download_filename_; 366 base::FilePath download_filename_;
362 scoped_ptr<SafeBrowsingStore> download_store_; 367 scoped_ptr<SafeBrowsingStore> download_store_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // Set to true if any chunks are added or deleted during an update. 408 // Set to true if any chunks are added or deleted during an update.
404 // Used to optimize away database update. 409 // Used to optimize away database update.
405 bool change_detected_; 410 bool change_detected_;
406 411
407 // Used to check if a prefix was in the database. 412 // Used to check if a prefix was in the database.
408 base::FilePath prefix_set_filename_; 413 base::FilePath prefix_set_filename_;
409 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; 414 scoped_ptr<safe_browsing::PrefixSet> prefix_set_;
410 }; 415 };
411 416
412 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 417 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/database_manager.cc ('k') | chrome/browser/safe_browsing/safe_browsing_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698