diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-02 00:47:47 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-02 00:47:47 +0000 |
commit | 3e72ed759ddc158877986c87cb8aeb7fb20a6fcb (patch) | |
tree | 43a45da6171450a4f741740074664185d1025609 /chrome/browser/safe_browsing/safe_browsing_database.h | |
parent | bc2a400794707a885c1c7247199d8ca1cd7be5ca (diff) | |
download | chromium_src-3e72ed759ddc158877986c87cb8aeb7fb20a6fcb.zip chromium_src-3e72ed759ddc158877986c87cb8aeb7fb20a6fcb.tar.gz chromium_src-3e72ed759ddc158877986c87cb8aeb7fb20a6fcb.tar.bz2 |
Add an extension blacklist safebrowsing store and use it in
extensions::Blacklist.
BUG=154149
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/11943016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/safe_browsing_database.h')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database.h | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h index 5abc97f..f24f37f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.h +++ b/chrome/browser/safe_browsing/safe_browsing_database.h @@ -36,7 +36,8 @@ class SafeBrowsingDatabaseFactory { virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( bool enable_download_protection, bool enable_client_side_whitelist, - bool enable_download_whitelist) = 0; + bool enable_download_whitelist, + bool enable_extension_blacklist) = 0; private: DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseFactory); }; @@ -66,7 +67,8 @@ class SafeBrowsingDatabase { // database feature. static SafeBrowsingDatabase* Create(bool enable_download_protection, bool enable_client_side_whitelist, - bool enable_download_whitelist); + bool enable_download_whitelist, + bool enable_extension_blacklist); // Makes the passed |factory| the factory used to instantiate // a SafeBrowsingDatabase. This is used for tests. @@ -119,6 +121,14 @@ class SafeBrowsingDatabase { virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) = 0; virtual bool ContainsDownloadWhitelistedString(const std::string& str) = 0; + // Populates |prefix_hits| with any prefixes in |prefixes| that have matches + // in the database. + // + // This function can ONLY be accessed from the creation thread. + virtual bool ContainsExtensionPrefixes( + const std::vector<SBPrefix>& prefixes, + std::vector<SBPrefix>* prefix_hits) = 0; + // A database transaction should look like: // // std::vector<SBListChunkRanges> lists; @@ -175,6 +185,10 @@ class SafeBrowsingDatabase { static FilePath DownloadWhitelistDBFilename( const FilePath& download_whitelist_base_filename); + // Filename for extension blacklist database. + static FilePath ExtensionBlacklistDBFilename( + const FilePath& extension_blacklist_base_filename); + // Enumerate failures for histogramming purposes. DO NOT CHANGE THE // ORDERING OF THESE VALUES. enum FailureType { @@ -196,6 +210,9 @@ class SafeBrowsingDatabase { FAILURE_DATABASE_PREFIX_SET_READ, FAILURE_DATABASE_PREFIX_SET_WRITE, FAILURE_DATABASE_PREFIX_SET_DELETE, + FAILURE_EXTENSION_BLACKLIST_UPDATE_BEGIN, + FAILURE_EXTENSION_BLACKLIST_UPDATE_FINISH, + FAILURE_EXTENSION_BLACKLIST_DELETE, // Memory space for histograms is determined by the max. ALWAYS // ADD NEW VALUES BEFORE THIS ONE. @@ -221,7 +238,8 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { SafeBrowsingDatabaseNew(SafeBrowsingStore* browse_store, SafeBrowsingStore* download_store, SafeBrowsingStore* csd_whitelist_store, - SafeBrowsingStore* download_whitelist_store); + SafeBrowsingStore* download_whitelist_store, + SafeBrowsingStore* extension_blacklist_store); // Create a database with a browse store. This is a legacy interface that // useds Sqlite. @@ -244,6 +262,9 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) OVERRIDE; virtual bool ContainsDownloadWhitelistedString( const std::string& str) OVERRIDE; + virtual bool ContainsExtensionPrefixes( + const std::vector<SBPrefix>& prefixes, + std::vector<SBPrefix>* prefix_hits) OVERRIDE; virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE; virtual void InsertChunks(const std::string& list_name, const SBChunkList& chunks) OVERRIDE; @@ -309,7 +330,10 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { void InsertSubChunks(safe_browsing_util::ListType list_id, const SBChunkList& chunks); - void UpdateDownloadStore(); + // Returns the size in bytes of the store after the update. + int64 UpdateHashPrefixStore(const FilePath& store_filename, + SafeBrowsingStore* store, + FailureType failure_type); void UpdateBrowseStore(); void UpdateWhitelistStore(const FilePath& store_filename, SafeBrowsingStore* store, @@ -344,8 +368,13 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { FilePath download_whitelist_filename_; scoped_ptr<SafeBrowsingStore> download_whitelist_store_; + // For extension IDs. + FilePath extension_blacklist_filename_; + scoped_ptr<SafeBrowsingStore> extension_blacklist_store_; + SBWhitelist csd_whitelist_; SBWhitelist download_whitelist_; + SBWhitelist extension_blacklist_; // Cached browse store related full-hash items, ordered by prefix for // efficient scanning. |