Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: components/safe_browsing_db/v4_local_database_manager.cc

Issue 2622063002: Add the missing callback to client for CheckResourceUrl. (Closed)
Patch Set: nit: fix mistake in rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 eaa1883b5412bfa47a80521e28e28f204ed9af6e..4e50b46dce53d34bf4a6786ffad87a0be971a184 100644
--- a/components/safe_browsing_db/v4_local_database_manager.cc
+++ b/components/safe_browsing_db/v4_local_database_manager.cc
@@ -490,9 +490,11 @@ bool V4LocalDatabaseManager::GetPrefixMatches(
void V4LocalDatabaseManager::GetSeverestThreatTypeAndMetadata(
SBThreatType* result_threat_type,
ThreatMetadata* metadata,
+ FullHash* matching_full_hash,
const std::vector<FullHashInfo>& full_hash_infos) {
DCHECK(result_threat_type);
DCHECK(metadata);
+ DCHECK(matching_full_hash);
ThreatSeverity most_severe_yet = kLeastSeverity;
for (const FullHashInfo& fhi : full_hash_infos) {
@@ -501,6 +503,7 @@ void V4LocalDatabaseManager::GetSeverestThreatTypeAndMetadata(
most_severe_yet = severity;
*result_threat_type = GetSBThreatTypeForList(fhi.list_id);
*metadata = fhi.metadata;
+ *matching_full_hash = fhi.full_hash;
}
}
}
@@ -595,7 +598,8 @@ void V4LocalDatabaseManager::OnFullHashResponse(
// Find out the most severe threat, if any, to report to the client.
GetSeverestThreatTypeAndMetadata(&check->result_threat_type,
- &check->url_metadata, full_hash_infos);
+ &check->url_metadata,
+ &check->matching_full_hash, full_hash_infos);
pending_checks_.erase(it);
RespondToClient(std::move(check));
}
@@ -662,6 +666,11 @@ void V4LocalDatabaseManager::RespondToClient(
const std::set<FullHash> extension_ids(check->full_hashes.begin(),
check->full_hashes.end());
check->client->OnCheckExtensionsResult(extension_ids);
+ } else if (check->client_callback_type ==
+ ClientCallbackType::CHECK_RESOURCE_URL) {
+ DCHECK_EQ(1u, check->urls.size());
+ check->client->OnCheckResourceUrlResult(
+ check->urls[0], check->result_threat_type, check->matching_full_hash);
} else {
NOTREACHED() << "Unexpected client_callback_type encountered";
}

Powered by Google App Engine
This is Rietveld 408576698