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

Unified Diff: components/safe_browsing_db/v4_local_database_manager.h

Issue 2890293004: Add the ability to check the CSD Whitelist asynchronously, for PhishGuard. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing_db/v4_local_database_manager.h
diff --git a/components/safe_browsing_db/v4_local_database_manager.h b/components/safe_browsing_db/v4_local_database_manager.h
index 9e3ea4fa00f545af8dd946576b08d71dbc227249..9e97cef7843fb12a8ac20306f01b5ed1e5eed356 100644
--- a/components/safe_browsing_db/v4_local_database_manager.h
+++ b/components/safe_browsing_db/v4_local_database_manager.h
@@ -53,6 +53,7 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
Client* client) override;
bool CheckResourceUrl(const GURL& url, Client* client) override;
bool CheckUrlForSubresourceFilter(const GURL& url, Client* client) override;
+ AsyncMatch CheckCsdWhitelistUrl(const GURL& url, Client* client) override;
bool MatchCsdWhitelistUrl(const GURL& url) override;
bool MatchDownloadWhitelistString(const std::string& str) override;
bool MatchDownloadWhitelistUrl(const GURL& url) override;
@@ -88,28 +89,32 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
enum class ClientCallbackType {
// This represents the case when we're trying to determine if a URL is
// unsafe from the following perspectives: Malware, Phishing, UwS.
- CHECK_BROWSE_URL = 0,
+ CHECK_BROWSE_URL,
// This represents the case when we're trying to determine if any of the
// URLs in a vector of URLs is unsafe for downloading binaries.
- CHECK_DOWNLOAD_URLS = 1,
+ CHECK_DOWNLOAD_URLS,
// This represents the case when we're trying to determine if a URL is an
// unsafe resource.
- CHECK_RESOURCE_URL = 2,
+ CHECK_RESOURCE_URL,
// This represents the case when we're trying to determine if a Chrome
// extension is a unsafe.
- CHECK_EXTENSION_IDS = 3,
+ CHECK_EXTENSION_IDS,
// This respresents the case when we're trying to determine if a URL belongs
// to the list where subresource filter should be active.
- CHECK_URL_FOR_SUBRESOURCE_FILTER = 4,
+ CHECK_URL_FOR_SUBRESOURCE_FILTER,
+
+ // This respresents the case when we're trying to determine if a URL is
+ // part of the CSD whitelist.
+ CHECK_CSD_WHITELIST,
// This represents the other cases when a check is being performed
// synchronously so a client callback isn't required. For instance, when
// trying to determing if an IP address is unsafe due to hosting Malware.
- CHECK_OTHER = 5,
+ CHECK_OTHER,
};
// The information we need to process a URL safety reputation request and
@@ -221,6 +226,15 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
// schedules a task to perform full hash check and returns false.
bool HandleCheck(std::unique_ptr<PendingCheck> check);
+ // Like HandleCheck, but for whitelists that have both full-hashes and
+ // partial hashes in the DB. Returns MATCH, NO_MATCH, or ASYNC.
+ AsyncMatch HandleWhitelistCheck(std::unique_ptr<PendingCheck> check);
+
+ // Schedules a full-hash check for a given set of prefixes.
+ void ScheduleFullHashCheck(std::unique_ptr<PendingCheck> check,
+ const FullHashToStoreAndHashPrefixesMap&
+ full_hash_to_store_and_hash_prefixes);
+
// Checks |stores_to_check| in database synchronously for hash prefixes
// matching |hash|. Returns true if there's a match; false otherwise. This is
// used for lists that have full hash information in the database.

Powered by Google App Engine
This is Rietveld 408576698