| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ | 6 #define CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 |
| 10 #include <memory> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/android/jni_android.h" | 13 #include "base/android/jni_android.h" |
| 12 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "chrome/browser/history/browsing_history_service_handler.h" | 16 #include "chrome/browser/history/browsing_history_service_handler.h" |
| 15 | 17 |
| 16 using base::android::JavaParamRef; | 18 using base::android::JavaParamRef; |
| 17 | 19 |
| 18 // The bridge for fetching browsing history information for the Android | 20 // The bridge for fetching browsing history information for the Android |
| 19 // history UI. This queries the BrowsingHistoryService and listens | 21 // history UI. This queries the BrowsingHistoryService and listens |
| 20 // for callbacks. | 22 // for callbacks. |
| 21 class BrowsingHistoryBridge : public BrowsingHistoryServiceHandler { | 23 class BrowsingHistoryBridge : public BrowsingHistoryServiceHandler { |
| 22 | |
| 23 public: | 24 public: |
| 24 explicit BrowsingHistoryBridge(JNIEnv* env, | 25 explicit BrowsingHistoryBridge(JNIEnv* env, |
| 25 const JavaParamRef<jobject>& obj, | 26 const JavaParamRef<jobject>& obj, |
| 26 jobject j_profile); | 27 jobject j_profile); |
| 27 void Destroy(JNIEnv*, const JavaParamRef<jobject>&); | 28 void Destroy(JNIEnv*, const JavaParamRef<jobject>&); |
| 28 | 29 |
| 29 void QueryHistory(JNIEnv* env, | 30 void QueryHistory(JNIEnv* env, |
| 30 const JavaParamRef<jobject>& obj, | 31 const JavaParamRef<jobject>& obj, |
| 31 const JavaParamRef<jobject>& j_result_obj, | 32 const JavaParamRef<jobject>& j_result_obj, |
| 32 jstring j_query, | 33 jstring j_query, |
| 33 int64_t j_query_end_time); | 34 int64_t j_query_end_time); |
| 34 | 35 |
| 35 // Adds a HistoryEntry with the |j_url| and |j_timestamps| to the list of | 36 // Adds a HistoryEntry with the |j_url| and |j_native_timestamps| to the list |
| 36 // items being removed. The removal will not be committed until | 37 // of items being removed. The removal will not be committed until |
| 37 // ::removeItems() is called. | 38 // ::removeItems() is called. |
| 38 void MarkItemForRemoval( | 39 void MarkItemForRemoval(JNIEnv* env, |
| 39 JNIEnv* env, | 40 const JavaParamRef<jobject>& obj, |
| 40 const JavaParamRef<jobject>& obj, | 41 jstring j_url, |
| 41 jstring j_url, | 42 const JavaParamRef<jlongArray>& j_native_timestamps); |
| 42 const JavaParamRef<jlongArray>& j_timestamps); | |
| 43 | 43 |
| 44 // Removes all items that have been marked for removal through | 44 // Removes all items that have been marked for removal through |
| 45 // ::markItemForRemoval(). | 45 // ::markItemForRemoval(). |
| 46 void RemoveItems(JNIEnv* env, | 46 void RemoveItems(JNIEnv* env, |
| 47 const JavaParamRef<jobject>& obj); | 47 const JavaParamRef<jobject>& obj); |
| 48 | 48 |
| 49 // BrowsingHistoryServiceHandler implementation | 49 // BrowsingHistoryServiceHandler implementation |
| 50 void OnQueryComplete( | 50 void OnQueryComplete( |
| 51 std::vector<BrowsingHistoryService::HistoryEntry>* results, | 51 std::vector<BrowsingHistoryService::HistoryEntry>* results, |
| 52 BrowsingHistoryService::QueryResultsInfo* query_results_info) override; | 52 BrowsingHistoryService::QueryResultsInfo* query_results_info) override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 std::vector<std::unique_ptr<BrowsingHistoryService::HistoryEntry>> | 66 std::vector<std::unique_ptr<BrowsingHistoryService::HistoryEntry>> |
| 67 items_to_remove_; | 67 items_to_remove_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryBridge); | 69 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryBridge); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 bool RegisterBrowsingHistoryBridge(JNIEnv* env); | 72 bool RegisterBrowsingHistoryBridge(JNIEnv* env); |
| 73 | 73 |
| 74 #endif // CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ | 74 #endif // CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
| OLD | NEW |