OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_REPORT_HISTORY_REPORT_JNI_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_HISTORY_REPORT_JNI_BRIDGE_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <string> |
| 10 |
| 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 |
| 15 namespace bookmarks { |
| 16 class BookmarkModel; |
| 17 } |
| 18 |
| 19 namespace history_report { |
| 20 |
| 21 class DataObserver; |
| 22 class DataProvider; |
| 23 class DeltaFileService; |
| 24 class UsageReportsBufferService; |
| 25 |
| 26 bool RegisterHistoryReportJniBridge(JNIEnv* env); |
| 27 |
| 28 // JNI Bridge which connects native and java parts of Icing integration. |
| 29 class HistoryReportJniBridge { |
| 30 public: |
| 31 HistoryReportJniBridge(JNIEnv* env, jobject obj); |
| 32 ~HistoryReportJniBridge(); |
| 33 |
| 34 // Removes entries with seqno <= seq_no_lower_bound from delta file. |
| 35 // Returns biggest seqno in delta file. |
| 36 jlong TrimDeltaFile(JNIEnv* env, jobject obj, jlong seq_no_lower_bound); |
| 37 // Queries delta file for up to limit entries with seqno > last_seq_no. |
| 38 base::android::ScopedJavaLocalRef<jobjectArray> Query(JNIEnv* env, |
| 39 jobject obj, |
| 40 jlong last_seq_no, |
| 41 jint limit); |
| 42 // Queries usage reports buffer for a batch of reports to be reported to |
| 43 // Icing. |
| 44 base::android::ScopedJavaLocalRef<jobjectArray> GetUsageReportsBatch( |
| 45 JNIEnv* env, |
| 46 jobject obj, |
| 47 jint batch_size); |
| 48 // Removes a batch of usage reports from a usage reports buffer. |
| 49 void RemoveUsageReports(JNIEnv* env, |
| 50 jobject obj, |
| 51 jobjectArray& batch); |
| 52 // Populates the usage reports buffer with historic visits. |
| 53 // This should happen only once per corpus registration. |
| 54 jboolean AddHistoricVisitsToUsageReportsBuffer(JNIEnv* env, jobject obj); |
| 55 // Dumps internal state. |
| 56 base::android::ScopedJavaLocalRef<jstring> Dump(JNIEnv* env, jobject obj); |
| 57 |
| 58 void NotifyDataChanged(); |
| 59 void NotifyDataCleared(); |
| 60 void StopReporting(); |
| 61 void StartReporting(); |
| 62 |
| 63 private: |
| 64 JavaObjectWeakGlobalRef weak_java_provider_; |
| 65 scoped_ptr<DataObserver> data_observer_; |
| 66 scoped_ptr<DataProvider> data_provider_; |
| 67 scoped_ptr<DeltaFileService> delta_file_service_; |
| 68 scoped_ptr<bookmarks::BookmarkModel> bookmark_model_; |
| 69 scoped_ptr<UsageReportsBufferService> usage_reports_buffer_service_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(HistoryReportJniBridge); |
| 72 }; |
| 73 |
| 74 } // namespace history_report |
| 75 |
| 76 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_HISTORY_REPORT_JNI_BRIDGE_H_ |
OLD | NEW |