OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 |
| 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 |
| 13 #include "base/android/jni_android.h" |
| 14 #include "base/macros.h" |
| 15 #include "chrome/browser/safe_browsing/remote_database_manager.h" |
| 16 |
| 17 class AndroidSafeBrowsingAPIHandler { |
| 18 public: |
| 19 AndroidSafeBrowsingAPIHandler(); |
| 20 |
| 21 // Makes Native->Java call. Takes ownership of client_request |
| 22 // Returns false if it fails to start and doesn't take ownership. |
| 23 bool StartRequest( |
| 24 RemoteSafeBrowsingDatabaseManager::ClientRequest* client_request); |
| 25 |
| 26 // Java->Native call, invoked when a request is done. Must be static. |
| 27 static void OnRequestDone(jlong client_req_id, |
| 28 jboolean isSuccessful, |
| 29 jstring metadata); |
| 30 |
| 31 protected: |
| 32 jobject j_context_; |
| 33 std::string api_key_; |
| 34 |
| 35 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(AndroidSafeBrowsingAPIHandler); |
| 37 }; |
| 38 |
| 39 #endif // CHROME_BROWSER_SAFE_BROWSING_ANDROID_SAFE_BROWSING_API_HANDLER_H_ |
OLD | NEW |