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

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

Issue 337723004: [Safe browsing] Clean up code to scan hash results for threats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/database_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/database_manager.h
diff --git a/chrome/browser/safe_browsing/database_manager.h b/chrome/browser/safe_browsing/database_manager.h
index 6db424e4b52d9511449a4e3c8ecdef8f45b31dd7..98e225f283adcbcb01faa4e8fa23d470a4e0964a 100644
--- a/chrome/browser/safe_browsing/database_manager.h
+++ b/chrome/browser/safe_browsing/database_manager.h
@@ -214,6 +214,7 @@ class SafeBrowsingDatabaseManager
friend class SafeBrowsingServiceTest;
friend class SafeBrowsingServiceTestHelper;
friend class SafeBrowsingDatabaseManagerTest;
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest, GetUrlThreatType);
typedef std::set<SafeBrowsingCheck*> CurrentChecks;
typedef std::vector<SafeBrowsingCheck*> GetHashRequestors;
@@ -234,6 +235,19 @@ class SafeBrowsingDatabaseManager
base::TimeTicks start; // When check was queued.
};
+ // Return the threat type from the first result in |full_hashes| which matches
+ // |hash|, or SAFE if none match.
+ static SBThreatType GetHashThreatType(
+ const SBFullHash& hash,
+ const std::vector<SBFullHashResult>& full_hashes);
+
+ // Given a URL, compare all the possible host + path full hashes to the set of
+ // provided full hashes. Returns the threat type of the matching result from
+ // |full_hashes|, or SAFE if none match.
+ static SBThreatType GetUrlThreatType(
+ const GURL& url,
+ const std::vector<SBFullHashResult>& full_hashes);
+
// Called to stop operations on the io_thread. This may be called multiple
// times during the life of the DatabaseManager. Should be called on IO
// thread.
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698