| OLD | NEW |
| 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 CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_H_ | 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_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 "chrome/browser/safe_browsing/safe_browsing_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)> URLCheckCallback; | 27 const std::string& metadata)> |
| 28 URLCheckCallback; |
| 28 | 29 |
| 29 // Makes Native->Java call and invokes callback when check is done. | 30 // Makes Native->Java call and invokes callback when check is done. |
| 30 virtual void StartURLCheck(const URLCheckCallback& callback, | 31 virtual void StartURLCheck(const URLCheckCallback& callback, |
| 31 const GURL& url, | 32 const GURL& url, |
| 32 const std::vector<SBThreatType>& threat_types) = 0; | 33 const std::vector<SBThreatType>& threat_types) = 0; |
| 33 | 34 |
| 34 virtual ~SafeBrowsingApiHandler() {} | 35 virtual ~SafeBrowsingApiHandler() {} |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 // Pointer not owned. | 38 // Pointer not owned. |
| 38 static SafeBrowsingApiHandler* instance_; | 39 static SafeBrowsingApiHandler* instance_; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 } // namespace safe_browsing | 42 } // namespace safe_browsing |
| 42 | 43 |
| 43 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_H_ | 44 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_API_HANDLER_H_ |
| OLD | NEW |