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..9bc2d6c3e67ea7fda44cdd84fae652ad3c3ffbfd 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,6 +140,30 @@ bool V4LocalDatabaseManager::CheckBrowseUrl(const GURL& url, Client* client) { |
return true; |
} |
+ // TODO(vakh): Queue check if v4_database_ isn't ready yet. |
+ 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; |
+ base::hash_set<UpdateListIdentifier> stores_to_look( |
+ {GetUrlMalwareId(), GetUrlSocEngId()}); |
+ 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((matched_stores.empty() && matched_hash_prefixes.empty()) || |
Nathan Parker
2016/08/15 19:06:41
DECHECK_EQ(matched_stores.empty(), matched_hash_pr
vakh (use Gerrit instead)
2016/08/17 18:23:06
Done.
|
+ (!matched_stores.empty() && !matched_hash_prefixes.empty())); |
+ // TODO(vakh): Fetch full hashes for the matching hash prefixes. |
Nathan Parker
2016/08/15 19:06:41
You need to invoke the client's callback asynchron
vakh (use Gerrit instead)
2016/08/17 18:23:06
This method is not being called from product code
|
+ return matched_hash_prefixes.empty(); |
+ } |
// Don't defer the resource load. |
return true; |
} |