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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 const JavaParamRef<jobject>& obj, | 25 const JavaParamRef<jobject>& obj, |
26 jobject j_profile); | 26 jobject j_profile); |
27 void Destroy(JNIEnv*, const JavaParamRef<jobject>&); | 27 void Destroy(JNIEnv*, const JavaParamRef<jobject>&); |
28 | 28 |
29 void QueryHistory(JNIEnv* env, | 29 void QueryHistory(JNIEnv* env, |
30 const JavaParamRef<jobject>& obj, | 30 const JavaParamRef<jobject>& obj, |
31 const JavaParamRef<jobject>& j_result_obj, | 31 const JavaParamRef<jobject>& j_result_obj, |
32 jstring j_query, | 32 jstring j_query, |
33 int64_t j_query_end_time); | 33 int64_t j_query_end_time); |
34 | 34 |
| 35 // Adds a HistoryEntry with the |j_url| and |j_timestamps| to the list of |
| 36 // items being removed. The removal will not be committed until |
| 37 // ::removeItems() is called. |
| 38 void MarkItemForRemoval( |
| 39 JNIEnv* env, |
| 40 const JavaParamRef<jobject>& obj, |
| 41 jstring j_url, |
| 42 const JavaParamRef<jlongArray>& j_timestamps); |
| 43 |
| 44 // Removes all items that have been marked for removal through |
| 45 // ::markItemForRemoval(). |
| 46 void RemoveItems(JNIEnv* env, |
| 47 const JavaParamRef<jobject>& obj); |
| 48 |
35 // BrowsingHistoryServiceHandler implementation | 49 // BrowsingHistoryServiceHandler implementation |
36 void OnQueryComplete( | 50 void OnQueryComplete( |
37 std::vector<BrowsingHistoryService::HistoryEntry>* results, | 51 std::vector<BrowsingHistoryService::HistoryEntry>* results, |
38 BrowsingHistoryService::QueryResultsInfo* query_results_info) override; | 52 BrowsingHistoryService::QueryResultsInfo* query_results_info) override; |
39 void OnRemoveVisitsComplete() override; | 53 void OnRemoveVisitsComplete() override; |
40 void OnRemoveVisitsFailed() override; | 54 void OnRemoveVisitsFailed() override; |
41 void HistoryDeleted() override; | 55 void HistoryDeleted() override; |
42 void HasOtherFormsOfBrowsingHistory( | 56 void HasOtherFormsOfBrowsingHistory( |
43 bool has_other_forms, bool has_synced_results) override; | 57 bool has_other_forms, bool has_synced_results) override; |
44 | 58 |
45 private: | 59 private: |
46 ~BrowsingHistoryBridge() override; | 60 ~BrowsingHistoryBridge() override; |
47 | 61 |
48 std::unique_ptr<BrowsingHistoryService> browsing_history_service_; | 62 std::unique_ptr<BrowsingHistoryService> browsing_history_service_; |
49 base::android::ScopedJavaGlobalRef<jobject> j_history_service_obj_; | 63 base::android::ScopedJavaGlobalRef<jobject> j_history_service_obj_; |
50 base::android::ScopedJavaGlobalRef<jobject> j_query_result_obj_; | 64 base::android::ScopedJavaGlobalRef<jobject> j_query_result_obj_; |
51 | 65 |
| 66 std::vector<std::unique_ptr<BrowsingHistoryService::HistoryEntry>> |
| 67 items_to_remove_; |
| 68 |
52 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryBridge); | 69 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryBridge); |
53 }; | 70 }; |
54 | 71 |
55 bool RegisterBrowsingHistoryBridge(JNIEnv* env); | 72 bool RegisterBrowsingHistoryBridge(JNIEnv* env); |
56 | 73 |
57 #endif // CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ | 74 #endif // CHROME_BROWSER_ANDROID_HISTORY_BROWSING_HISTORY_BRIDGE_H_ |
OLD | NEW |