OLD | NEW |
(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 #ifndef CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/macros.h" |
| 14 #include "chrome/browser/history/browsing_history_service_handler.h" |
| 15 |
| 16 using base::android::JavaParamRef; |
| 17 |
| 18 // The bridge for fetching browsing history information for the Android |
| 19 // history UI. This queries the BrowsingHistoryService and listens |
| 20 // for callbacks. |
| 21 class BrowsingHistoryBridge : public BrowsingHistoryServiceHandler { |
| 22 |
| 23 public: |
| 24 explicit BrowsingHistoryBridge(JNIEnv* env, |
| 25 const JavaParamRef<jobject>& obj, |
| 26 jobject j_profile); |
| 27 void Destroy(JNIEnv*, const JavaParamRef<jobject>&); |
| 28 |
| 29 void QueryHistory(JNIEnv* env, |
| 30 const JavaParamRef<jobject>& obj, |
| 31 const JavaParamRef<jobject>& j_result_obj, |
| 32 jstring j_query, |
| 33 int64_t j_query_end_time); |
| 34 |
| 35 // BrowsingHistoryServiceHandler implementation |
| 36 void OnQueryComplete( |
| 37 std::vector<BrowsingHistoryService::HistoryEntry>* results, |
| 38 BrowsingHistoryService::QueryResultsInfo* query_results_info) override; |
| 39 void OnRemoveVisitsComplete() override; |
| 40 void OnRemoveVisitsFailed() override; |
| 41 void HistoryDeleted() override; |
| 42 void HasOtherFormsOfBrowsingHistory( |
| 43 bool has_other_forms, bool has_synced_results) override; |
| 44 |
| 45 private: |
| 46 ~BrowsingHistoryBridge() override; |
| 47 |
| 48 std::unique_ptr<BrowsingHistoryService> browsing_history_service_; |
| 49 base::android::ScopedJavaGlobalRef<jobject> j_history_service_obj_; |
| 50 base::android::ScopedJavaGlobalRef<jobject> j_query_result_obj_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryBridge); |
| 53 }; |
| 54 |
| 55 bool RegisterBrowsingHistoryBridge(JNIEnv* env); |
| 56 |
| 57 #endif // CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
OLD | NEW |