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

Unified Diff: components/safe_browsing_db/database_manager.cc

Issue 1881353002: SafeBrowsing: Adds response handler for API blacklist check in Database Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@osb-impl-1
Patch Set: Rebase Created 4 years, 8 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/database_manager.cc
diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing_db/database_manager.cc
index c8d7aa30afa2ae750bd85757b4927043b5e5bae0..df67504207e3e34c1e977978165770c5dcc82378 100644
--- a/components/safe_browsing_db/database_manager.cc
+++ b/components/safe_browsing_db/database_manager.cc
@@ -86,7 +86,22 @@ void SafeBrowsingDatabaseManager::HandleGetHashesWithApisResults(
const std::vector<SBFullHashResult>& full_hash_results,
const base::TimeDelta& negative_cache_duration) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- // TODO(kcarattini): Implement response handler.
+ DCHECK(check);
Nathan Parker 2016/04/15 23:22:00 Sounds like a microphone check. "Check. Check. Ch
kcarattini 2016/04/18 07:12:02 Acknowledged.
+
+ ThreatMetadata md;
+ // Merge the metadata from all matching results.
+ for (const SBFullHashResult& result : full_hash_results) {
Nathan Parker 2016/04/15 23:22:00 This is sort of O(N^2), where N is small but could
kcarattini 2016/04/18 07:12:02 Done.
+ for (const SBFullHash& full_hash : check->full_hashes()) {
+ if (SBFullHashEqual(full_hash, result.hash)) {
+ md.api_permissions.insert(md.api_permissions.end(),
+ result.metadata.api_permissions.begin(),
+ result.metadata.api_permissions.end());
+ break;
+ }
+ }
+ }
+
+ check->client()->OnCheckApiBlacklistUrlResult(check->url(), md);
Nathan Parker 2016/04/15 23:22:00 Consider if we need the URL to be passed here, and
kcarattini 2016/04/18 07:12:02 I can imagine a client making calls for multiple u
Nathan Parker 2016/04/18 17:34:09 k. Another approach is that the caller could use
}
SafeBrowsingDatabaseManager::SafeBrowsingApiCheck::SafeBrowsingApiCheck(
« no previous file with comments | « components/safe_browsing_db/database_manager.h ('k') | components/safe_browsing_db/database_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698