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..53bab54617fdc5e5d15ee9a244cb5ca32083a511 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_database.h |
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h |
@@ -42,7 +42,8 @@ class SafeBrowsingDatabaseFactory { |
bool enable_download_whitelist, |
bool enable_extension_blacklist, |
bool enable_ip_blacklist, |
- bool enable_unwanted_software_list) = 0; |
+ bool enable_unwanted_software_list, |
+ bool enable_resource_blacklists_list) = 0; |
private: |
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseFactory); |
@@ -73,7 +74,8 @@ class SafeBrowsingDatabase { |
bool enable_download_whitelist, |
bool enable_extension_blacklist, |
bool enable_ip_blacklist, |
- bool enable_unwanted_software_list); |
+ bool enable_unwanted_software_list, |
+ bool enable_resource_blacklist); |
Nathan Parker
2016/02/16 21:42:00
Do you need this?
veranika
2016/02/17 15:37:54
Probably I don't. I added it here mostly to be uni
|
// Makes the passed |factory| the factory used to instantiate |
// a SafeBrowsingDatabase. This is used for tests. |
@@ -170,6 +172,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 +271,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 +317,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 +349,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 +380,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 +701,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 +717,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 |