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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.h

Issue 1579183003: Only call UrlToFullHashes once from LocalSafeBrowsingDatabaseManager::CheckBrowseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_database.h
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h
index c7f6599aa3f744fcc932cec5bdbdd3f053d7c447..cae9129d7d8995d27269650390296d7ae0052963 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.h
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h
@@ -99,6 +99,16 @@ class SafeBrowsingDatabase {
std::vector<SBPrefix>* prefix_hits,
std::vector<SBFullHashResult>* cache_hits) = 0;
+ // Returns false if none of the hashes in |full_hashes| are in the browse
+ // database or all were already cached as a miss. If it returns true,
+ // |prefix_hits| contains sorted unique matching hash prefixes which had no
+ // cached results and |cache_hits| contains any matching cached gethash
+ // results. This function is safe to call from any thread.
+ virtual bool ContainsBrowseHashes(
+ const std::vector<SBFullHash>& full_hashes,
+ std::vector<SBPrefix>* prefix_hits,
+ std::vector<SBFullHashResult>* cache_hits) = 0;
+
// Returns true iff the given url is on the unwanted software blacklist.
// Returns false if |url| is not in the browse database or already was cached
// as a miss. If it returns true, |prefix_hits| contains sorted unique
@@ -110,6 +120,18 @@ class SafeBrowsingDatabase {
std::vector<SBPrefix>* prefix_hits,
std::vector<SBFullHashResult>* cache_hits) = 0;
+ // Returns true iff any of the given hashes are on the unwanted software
+ // blacklist.
+ // Returns false if none of the hashes in |full_hashes| are in the browse
+ // database or all were already cached as a miss. If it returns true,
+ // |prefix_hits| contains sorted unique matching hash prefixes which had no
+ // cached results and |cache_hits| contains any matching cached gethash
+ // results. This function is safe to call from any thread.
+ virtual bool ContainsUnwantedSoftwareHashes(
+ const std::vector<SBFullHash>& full_hashes,
+ std::vector<SBPrefix>* prefix_hits,
+ std::vector<SBFullHashResult>* cache_hits) = 0;
+
// Returns false if none of |prefixes| are in Download database. If it returns
// true, |prefix_hits| should contain the prefixes for the URLs that were in
// the database. This function can ONLY be accessed from creation thread.
@@ -321,10 +343,17 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
bool ContainsBrowseUrl(const GURL& url,
std::vector<SBPrefix>* prefix_hits,
std::vector<SBFullHashResult>* cache_hits) override;
+ bool ContainsBrowseHashes(const std::vector<SBFullHash>& full_hashes,
+ std::vector<SBPrefix>* prefix_hits,
+ std::vector<SBFullHashResult>* cache_hits) override;
bool ContainsUnwantedSoftwareUrl(
const GURL& url,
std::vector<SBPrefix>* prefix_hits,
std::vector<SBFullHashResult>* cache_hits) override;
+ bool ContainsUnwantedSoftwareHashes(
+ const std::vector<SBFullHash>& full_hashes,
+ std::vector<SBPrefix>* prefix_hits,
+ std::vector<SBFullHashResult>* cache_hits) override;
bool ContainsDownloadUrlPrefixes(const std::vector<SBPrefix>& prefixes,
std::vector<SBPrefix>* prefix_hits) override;
bool ContainsCsdWhitelistedUrl(const GURL& url) override;
@@ -531,13 +560,6 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
std::vector<SBPrefix>* prefix_hits,
std::vector<SBFullHashResult>* cache_hits);
- // Exposed for testing of PrefixSetContainsUrlHashes() on the
- // PrefixSet backing kMalwareList.
- bool ContainsBrowseUrlHashesForTesting(
- const std::vector<SBFullHash>& full_hashes,
- std::vector<SBPrefix>* prefix_hits,
- std::vector<SBFullHashResult>* cache_hits);
-
bool PrefixSetContainsUrlHashes(const std::vector<SBFullHash>& full_hashes,
PrefixSetId prefix_set_id,
std::vector<SBPrefix>* prefix_hits,
« no previous file with comments | « chrome/browser/safe_browsing/local_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