Chromium Code Reviews| Index: components/safe_browsing_db/v4_local_database_manager.cc |
| diff --git a/components/safe_browsing_db/v4_local_database_manager.cc b/components/safe_browsing_db/v4_local_database_manager.cc |
| index 5f555cfdd7333dc436696c4ac30767de7c779eb8..5f0a5bff5fc36b2921250142795f5955634a550c 100644 |
| --- a/components/safe_browsing_db/v4_local_database_manager.cc |
| +++ b/components/safe_browsing_db/v4_local_database_manager.cc |
| @@ -42,8 +42,8 @@ bool V4LocalDatabaseManager::IsSupported() const { |
| return true; |
| } |
| -safe_browsing::ThreatSource V4LocalDatabaseManager::GetThreatSource() const { |
| - return safe_browsing::ThreatSource::LOCAL_PVER4; |
| +ThreatSource V4LocalDatabaseManager::GetThreatSource() const { |
| + return ThreatSource::LOCAL_PVER4; |
| } |
| bool V4LocalDatabaseManager::ChecksAreAlwaysAsync() const { |
| @@ -140,8 +140,34 @@ bool V4LocalDatabaseManager::CheckBrowseUrl(const GURL& url, Client* client) { |
| return true; |
| } |
| - // Don't defer the resource load. |
| - return true; |
| + base::hash_set<UpdateListIdentifier> stores_to_look( |
| + {GetUrlMalwareId(), GetUrlSocEngId()}); |
|
Scott Hess - ex-Googler
2016/08/17 23:04:38
This can be in the if() block.
vakh (use Gerrit instead)
2016/08/17 23:51:07
Done.
|
| + if (v4_database_) { |
| + base::hash_set<FullHash> full_hashes; |
| + V4ProtocolManagerUtil::UrlToFullHashes(url, &full_hashes); |
| + |
| + base::hash_set<HashPrefix> matched_hash_prefixes; |
| + base::hash_set<UpdateListIdentifier> matched_stores; |
| + MatchedHashPrefixMap matched_hash_prefix_map; |
| + for (const auto& full_hash : full_hashes) { |
| + v4_database_->GetStoresMatchingFullHash(full_hash, stores_to_look, |
| + &matched_hash_prefix_map); |
| + for (const auto& matched_pair : matched_hash_prefix_map) { |
| + matched_stores.insert(matched_pair.first); |
| + matched_hash_prefixes.insert(matched_pair.second); |
| + } |
| + } |
| + |
| + DCHECK_EQ(matched_stores.empty(), matched_hash_prefixes.empty()); |
| + |
| + // TODO(vakh): Return false and fetch full hashes for the matching hash |
| + // prefixes. |
| + return matched_hash_prefixes.empty(); |
| + } else { |
| + // TODO(vakh): Queue the check and process it when the database becomes |
| + // ready. |
| + return false; |
| + } |
| } |
| void V4LocalDatabaseManager::CancelCheck(Client* client) { |