| Index: components/safe_browsing_db/database_manager.h
|
| diff --git a/components/safe_browsing_db/database_manager.h b/components/safe_browsing_db/database_manager.h
|
| index 2b55d3dc5a25679307fa65d2b2d9ec00c036fc34..e2f94383494d5ca376ae177e78448f455ec39e3e 100644
|
| --- a/components/safe_browsing_db/database_manager.h
|
| +++ b/components/safe_browsing_db/database_manager.h
|
| @@ -180,12 +180,16 @@ class SafeBrowsingDatabaseManager
|
| SafeBrowsingApiCheck(const GURL& url,
|
| const std::vector<SBPrefix>& prefixes,
|
| const std::vector<SBFullHash>& full_hashes,
|
| + const std::vector<SBFullHashResult>& cached_results,
|
| Client* client);
|
| ~SafeBrowsingApiCheck();
|
|
|
| const GURL& url() {return url_;}
|
| const std::vector<SBPrefix>& prefixes() {return prefixes_;}
|
| const std::vector<SBFullHash>& full_hashes() {return full_hashes_;}
|
| + const std::vector<SBFullHashResult>& cached_results() {
|
| + return cached_results_;
|
| + }
|
| SafeBrowsingDatabaseManager::Client* client() {return client_;}
|
|
|
| private:
|
| @@ -197,6 +201,9 @@ class SafeBrowsingDatabaseManager
|
| // Full hashes for this check.
|
| std::vector<SBFullHash> full_hashes_;
|
|
|
| + // Cached results for this check.
|
| + std::vector<SBFullHashResult> cached_results_;
|
| +
|
| // Not owned.
|
| SafeBrowsingDatabaseManager::Client* client_;
|
|
|
| @@ -223,6 +230,10 @@ class SafeBrowsingDatabaseManager
|
| ResultsAreCached);
|
| FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
|
| ResultsAreNotCachedOnNull);
|
| + FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
|
| + GetCachedResults);
|
| + FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
|
| + CachedResultsMerged);
|
|
|
| typedef std::set<SafeBrowsingApiCheck*> ApiCheckSet;
|
| typedef std::map<SBPrefix, SBCachedFullHashResult> PrefixToFullHashResultsMap;
|
| @@ -235,6 +246,19 @@ class SafeBrowsingDatabaseManager
|
| const std::vector<SBFullHashResult>& full_hash_results,
|
| const base::Time& negative_cache_expire);
|
|
|
| + // Fills |prefixes| with the prefixes that need a request. Fills
|
| + // |cached_results| with the cached results.
|
| + void GetCachedResults(const std::vector<SBFullHash>& full_hashes,
|
| + base::Time now,
|
| + std::vector<SBPrefix>* prefixes,
|
| + std::vector<SBFullHashResult>* cached_results);
|
| +
|
| + // Populates |md| with permission metadata from all results that have a match
|
| + // in |full_hashes|.
|
| + void PopulateMetadataResult(const std::vector<SBFullHashResult>& results,
|
| + const std::vector<SBFullHash>& full_hashes,
|
| + ThreatMetadata* md);
|
| +
|
| // In-progress checks. This set owns the SafeBrowsingApiCheck pointers and is
|
| // responsible for deleting them when removing from the set.
|
| ApiCheckSet api_checks_;
|
|
|