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

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

Issue 1673733002: Support new Safe Browsing list "goog-badresource-shavar" in SafeBrowsingDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 10 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 cae9129d7d8995d27269650390296d7ae0052963..5a3ba3e6559aba8edd27f9c5b0f9816613fb353a 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.h
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h
@@ -170,6 +170,14 @@ class SafeBrowsingDatabase {
// This function is safe to call from any thread.
virtual bool ContainsMalwareIP(const std::string& ip_address) = 0;
+ // Populates |prefix_hits| with any prefixes in |prefixes| that have matches
+ // in the database. Returns true iff there were any matches.
+ //
+ // This function can ONLY by accessed from the creation thread.
+ virtual bool ContainsResourceUrlPrefixes(
+ const std::vector<SBPrefix>& prefixes,
+ std::vector<SBPrefix>* prefix_hits) = 0;
+
// A database transaction should look like:
//
// std::vector<SBListChunkRanges> lists;
@@ -261,6 +269,9 @@ class SafeBrowsingDatabase {
static base::FilePath UnwantedSoftwareDBFilename(
const base::FilePath& db_filename);
+ static base::FilePath ResourceBlacklistDBFilename(
+ const base::FilePath& db_filename);
+
// Get the prefixes matching the download |urls|.
static void GetDownloadUrlPrefixes(const std::vector<GURL>& urls,
std::vector<SBPrefix>* prefixes);
@@ -304,6 +315,9 @@ class SafeBrowsingDatabase {
FAILURE_UNWANTED_SOFTWARE_PREFIX_SET_READ = 32,
FAILURE_UNWANTED_SOFTWARE_PREFIX_SET_WRITE = 33,
FAILURE_UNWANTED_SOFTWARE_PREFIX_SET_DELETE = 34,
+ FAILURE_RESOURCE_BLACKLIST_UPDATE_BEGIN = 35,
+ FAILURE_RESOURCE_BLACKLIST_UPDATE_FINISH = 36,
+ FAILURE_RESOURCE_BLACKLIST_DELETE = 37,
// Memory space for histograms is determined by the max. ALWAYS
// ADD NEW VALUES BEFORE THIS ONE.
@@ -333,7 +347,8 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
SafeBrowsingStore* inclusion_whitelist_store,
SafeBrowsingStore* extension_blacklist_store,
SafeBrowsingStore* ip_blacklist_store,
- SafeBrowsingStore* unwanted_software_store);
+ SafeBrowsingStore* unwanted_software_store,
+ SafeBrowsingStore* resource_blacklist_store);
~SafeBrowsingDatabaseNew() override;
@@ -363,6 +378,9 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes,
std::vector<SBPrefix>* prefix_hits) override;
bool ContainsMalwareIP(const std::string& ip_address) override;
+ bool ContainsResourceUrlPrefixes(const std::vector<SBPrefix>& prefixes,
+ std::vector<SBPrefix>* prefix_hits) override;
+
bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override;
void InsertChunks(
const std::string& list_name,
@@ -681,6 +699,8 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
// - |ip_blacklist_store_|: For IP blacklist.
// - |unwanted_software_store_|: For unwanted software list (format
// identical to browsing lists).
+ // - |resource_blacklist_store_|: For script resource list (format identical
+ // to browsing lists).
//
// The stores themselves will be modified throughout the existence of this
// database, but shouldn't ever be swapped out (hence the const scoped_ptr --
@@ -695,6 +715,7 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
const scoped_ptr<SafeBrowsingStore> extension_blacklist_store_;
const scoped_ptr<SafeBrowsingStore> ip_blacklist_store_;
const scoped_ptr<SafeBrowsingStore> unwanted_software_store_;
+ const scoped_ptr<SafeBrowsingStore> resource_blacklist_store_;
// Used to schedule resetting the database because of corruption. This factory
// and the WeakPtrs it issues should only be used on the database's main

Powered by Google App Engine
This is Rietveld 408576698