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

Side by Side 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, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h"
5 #include "components/safe_browsing_db/safe_browsing_api_handler.h" 6 #include "components/safe_browsing_db/safe_browsing_api_handler.h"
6 7
7 namespace safe_browsing { 8 namespace safe_browsing {
8 9
10 namespace {
11
12 // TODO(nparker): Remove this as part of crbug/589610.
13 void OnRequestDoneShim(
14 const SafeBrowsingApiHandler::URLCheckCallbackMeta& callback,
15 SBThreatType sb_threat_type,
16 const std::string& raw_metadata) {
17 ThreatMetadata metadata_struct;
18 metadata_struct.raw_metadata = raw_metadata;
19 callback.Run(sb_threat_type, metadata_struct);
20 }
21
22 } // namespace
23
9 SafeBrowsingApiHandler* SafeBrowsingApiHandler::instance_ = NULL; 24 SafeBrowsingApiHandler* SafeBrowsingApiHandler::instance_ = NULL;
10 25
11 // static 26 // static
12 void SafeBrowsingApiHandler::SetInstance(SafeBrowsingApiHandler* instance) { 27 void SafeBrowsingApiHandler::SetInstance(SafeBrowsingApiHandler* instance) {
13 instance_ = instance; 28 instance_ = instance;
14 } 29 }
15 30
16 // static 31 // static
17 SafeBrowsingApiHandler* SafeBrowsingApiHandler::GetInstance() { 32 SafeBrowsingApiHandler* SafeBrowsingApiHandler::GetInstance() {
18 return instance_; 33 return instance_;
19 } 34 }
20 35
36 // TODO(nparker): Remove this as part of crbug/589610.
37 // Default impl since clank/ code doesn't yet support this.
38 void SafeBrowsingApiHandler::StartURLCheck(
39 const URLCheckCallbackMeta& callback,
40 const GURL& url,
41 const std::vector<SBThreatType>& threat_types) {
42 URLCheckCallback impl_callback = base::Bind(OnRequestDoneShim, callback);
43 StartURLCheck(impl_callback, url, threat_types);
44 }
45
21 } // namespace safe_browsing 46 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698