OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
mattm
2015/05/12 07:00:41
copyright in new files shouldn't have (c) (https:/
Nathan Parker
2015/05/12 18:23:20
Done, here and elsewhere.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // Glue to pass Safe Browsing API requests between | |
6 // RemoteSafeBrowsingDatabaseManager and Java-based API to check URLs. | |
7 | |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_ANDROID_SAFE_BROWSING_API_HANDLER_H_ | |
9 #define CHROME_BROWSER_SAFE_BROWSING_ANDROID_SAFE_BROWSING_API_HANDLER_H_ | |
10 | |
11 #include <string> | |
12 #include <vector> | |
13 | |
14 #include "base/android/jni_android.h" | |
15 #include "base/callback.h" | |
16 #include "base/macros.h" | |
17 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | |
18 #include "url/gurl.h" | |
19 | |
20 typedef base::Callback<void(SBThreatType sb_threat_type, | |
21 const std::string& metadata)> URLCheckCallback; | |
22 | |
23 class AndroidSafeBrowsingAPIHandler { | |
24 public: | |
25 AndroidSafeBrowsingAPIHandler(); | |
26 | |
27 // Makes Native->Java call and invokes callback when check is done. | |
28 // Returns false if it fails to start. | |
29 bool StartURLCheck( | |
30 const URLCheckCallback& callback, | |
31 const GURL& url, | |
32 const std::vector<SBThreatType>& threat_types); | |
33 | |
34 // Java->Native call, invoked when a check is done. |callback_id| is an | |
35 // int form of pointer to a URLCheckCallback that will be called and then | |
36 // deleted here. | |
37 static void OnURLCheckDone(jlong callback_id, | |
38 jboolean isSuccessful, | |
39 jstring metadata); | |
40 | |
41 protected: | |
42 jobject j_context_; | |
43 std::string api_key_; | |
44 | |
45 private: | |
46 DISALLOW_COPY_AND_ASSIGN(AndroidSafeBrowsingAPIHandler); | |
47 }; | |
48 #endif // CHROME_BROWSER_SAFE_BROWSING_ANDROID_SAFE_BROWSING_API_HANDLER_H_ | |
OLD | NEW |