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

Side by Side Diff: chrome/browser/android/safe_browsing/safe_browsing_api_handler_bridge.h

Issue 2622773002: Componentize SafeBrowsingApi{Bridge,Handler} (Closed)
Patch Set: Addressing vakh@'s comments Created 3 years, 11 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
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 Chrome and GMSCore
6
7 #ifndef CHROME_BROWSER_ANDROID_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_BRIDGE_H_
8 #define CHROME_BROWSER_ANDROID_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_BRIDGE_H_
9
10 #include <jni.h>
11
12 #include <string>
13 #include <vector>
14
15 #include "base/android/jni_android.h"
16 #include "base/macros.h"
17 #include "components/safe_browsing_db/safe_browsing_api_handler.h"
18 #include "url/gurl.h"
19
20 namespace safe_browsing {
21 bool RegisterSafeBrowsingApiBridge(JNIEnv* env);
22
23 class SafeBrowsingApiHandlerBridge : public SafeBrowsingApiHandler {
24 public:
25 SafeBrowsingApiHandlerBridge();
26 ~SafeBrowsingApiHandlerBridge() override;
27
28 // Makes Native->Java call to check the URL against Safe Browsing lists.
29 void StartURLCheck(const URLCheckCallbackMeta& callback,
30 const GURL& url,
31 const std::vector<SBThreatType>& threat_types) override;
32
33 private:
34 // Creates the j_api_handler_ if it hasn't been already. If the API is not
35 // supported, this will return false and j_api_handler_ will remain NULL.
36 bool CheckApiIsSupported();
37
38 // The Java-side SafeBrowsingApiHandler. Must call CheckApiIsSupported first.
39 base::android::ScopedJavaLocalRef<jobject> j_api_handler_;
40
41 // True if we've once tried to create the above object.
42 bool checked_api_support_;
43
44 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingApiHandlerBridge);
45 };
46
47 } // namespace safe_browsing
48 #endif // CHROME_BROWSER_ANDROID_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_BRIDGE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698