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

Unified Diff: components/safe_browsing_db/safe_browsing_api_handler.cc

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mattm's comments Created 4 years, 10 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/safe_browsing_api_handler.cc
diff --git a/components/safe_browsing_db/safe_browsing_api_handler.cc b/components/safe_browsing_db/safe_browsing_api_handler.cc
index fd3c3cee30bbc76f2242bb1e1007d268190abdcf..178a35dacd098a5978e19a953b66bdeb3782f6b3 100644
--- a/components/safe_browsing_db/safe_browsing_api_handler.cc
+++ b/components/safe_browsing_db/safe_browsing_api_handler.cc
@@ -2,10 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "components/safe_browsing_db/safe_browsing_api_handler.h"
namespace safe_browsing {
+namespace {
+
+// TODO(nparker): Remove this as part of crbug/589610.
+void OnRequestDoneShim(
+ const SafeBrowsingApiHandler::URLCheckCallbackMeta& callback,
+ SBThreatType sb_threat_type,
+ const std::string& raw_metadata) {
+ ThreatMetadata metadata_struct;
+ metadata_struct.raw_metadata = raw_metadata;
+ callback.Run(sb_threat_type, metadata_struct);
+}
+
+} // namespace
+
SafeBrowsingApiHandler* SafeBrowsingApiHandler::instance_ = NULL;
// static
@@ -18,4 +33,14 @@ SafeBrowsingApiHandler* SafeBrowsingApiHandler::GetInstance() {
return instance_;
}
+// TODO(nparker): Remove this as part of crbug/589610.
+// Default impl since clank/ code doesn't yet support this.
+void SafeBrowsingApiHandler::StartURLCheck(
+ const URLCheckCallbackMeta& callback,
+ const GURL& url,
+ const std::vector<SBThreatType>& threat_types) {
+ URLCheckCallback impl_callback = base::Bind(OnRequestDoneShim, callback);
+ StartURLCheck(impl_callback, url, threat_types);
+}
+
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698