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

Side by Side Diff: components/safe_browsing_db/safe_browsing_api_handler.h

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 safe_browsing_service_browsertest and update components_tests.gyp 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 // Glue to pass Safe Browsing API requests between 5 // Glue to pass Safe Browsing API requests between
6 // RemoteSafeBrowsingDatabaseManager and Java-based API to check URLs. 6 // RemoteSafeBrowsingDatabaseManager and Java-based API to check URLs.
7 7
8 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_ 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_
9 #define COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_ 9 #define COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "components/safe_browsing_db/util.h" 15 #include "components/safe_browsing_db/util.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace safe_browsing { 18 namespace safe_browsing {
19 19
20 class SafeBrowsingApiHandler { 20 class SafeBrowsingApiHandler {
21 public: 21 public:
22 // Singleton interface. 22 // Singleton interface.
23 static void SetInstance(SafeBrowsingApiHandler* instance); 23 static void SetInstance(SafeBrowsingApiHandler* instance);
24 static SafeBrowsingApiHandler* GetInstance(); 24 static SafeBrowsingApiHandler* GetInstance();
25 25
26 typedef base::Callback<void(SBThreatType sb_threat_type, 26 typedef base::Callback<void(SBThreatType sb_threat_type,
27 const std::string& metadata)> 27 const ThreatMetadata& metadata)>
28 URLCheckCallbackMeta;
29
30 // TODO(nparker): Remove this as part of crbug/589610.
31 typedef base::Callback<void(SBThreatType sb_threat_type,
32 const std::string& metadata_str)>
28 URLCheckCallback; 33 URLCheckCallback;
29 34
30 // Makes Native->Java call and invokes callback when check is done. 35 // Makes Native->Java call and invokes callback when check is done.
36 // TODO(nparker): Switch this back to pure virtual. crbug/589610.
37 virtual void StartURLCheck(const URLCheckCallbackMeta& callback,
38 const GURL& url,
39 const std::vector<SBThreatType>& threat_types);
40
41 // TODO(nparker): Remove this as part of crbug/589610.
31 virtual void StartURLCheck(const URLCheckCallback& callback, 42 virtual void StartURLCheck(const URLCheckCallback& callback,
32 const GURL& url, 43 const GURL& url,
33 const std::vector<SBThreatType>& threat_types) = 0; 44 const std::vector<SBThreatType>& threat_types) {};
34 45
35 virtual ~SafeBrowsingApiHandler() {} 46 virtual ~SafeBrowsingApiHandler() {}
36 47
37 private: 48 private:
38 // Pointer not owned. 49 // Pointer not owned.
39 static SafeBrowsingApiHandler* instance_; 50 static SafeBrowsingApiHandler* instance_;
40 }; 51 };
41 52
42 } // namespace safe_browsing 53 } // namespace safe_browsing
43 54
44 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_ 55 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698