Index: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h |
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h |
index 1d29614a0ebc28ae94e64b95fe96378ca57522d1..835a5b7b66ec24e875e94b6048d454f715454264 100644 |
--- a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h |
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h |
@@ -5,14 +5,20 @@ |
#ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
#define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
+#include <jni.h> |
+ |
#include <memory> |
+#include <vector> |
+#include "base/android/jni_android.h" |
#include "base/android/jni_string.h" |
#include "base/android/jni_weak_ref.h" |
#include "base/android/scoped_java_ref.h" |
#include "base/compiler_specific.h" |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/data_reduction_proxy/proto/data_store.pb.h" |
#include "components/prefs/pref_member.h" |
using base::android::ScopedJavaLocalRef; |
@@ -28,7 +34,9 @@ class DataReductionProxySettings; |
// be called from there. |
class DataReductionProxySettingsAndroid { |
public: |
- DataReductionProxySettingsAndroid(); |
+ DataReductionProxySettingsAndroid( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& obj); |
virtual ~DataReductionProxySettingsAndroid(); |
@@ -51,6 +59,9 @@ class DataReductionProxySettingsAndroid { |
jlong GetDataReductionLastUpdateTime( |
JNIEnv* env, |
const base::android::JavaParamRef<jobject>& obj); |
+ void ClearDataSavingStatistics( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& obj); |
jlong GetTotalHttpContentLengthSaved( |
JNIEnv* env, |
const base::android::JavaParamRef<jobject>& obj); |
@@ -96,19 +107,39 @@ class DataReductionProxySettingsAndroid { |
JNIEnv* env, |
const base::android::JavaParamRef<jobject>& obj); |
+ // Gets the historical data usage for |numDays| and adds them to a list that |
+ // groups data use by hostname. |
+ void QueryDataUsage(JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& obj, |
+ const base::android::JavaParamRef<jobject>& j_result_obj, |
+ jint num_days); |
+ void OnQueryDataUsageComplete( |
+ std::unique_ptr<std::vector<data_reduction_proxy::DataUsageBucket>> |
+ data_usage); |
+ |
// Registers the native methods to be call from Java. |
static bool Register(JNIEnv* env); |
+ JavaObjectWeakGlobalRef j_settings_obj_; |
+ base::android::ScopedJavaGlobalRef<jobject> j_query_result_obj_; |
+ int num_day_for_query_; |
+ |
private: |
friend class DataReductionProxySettingsAndroidTest; |
+ friend class TestDataReductionProxySettingsAndroid; |
FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest, |
TestGetDailyContentLengths); |
+ // For testing purposes. |
+ DataReductionProxySettingsAndroid(); |
+ |
ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, |
const char* pref_name); |
virtual data_reduction_proxy::DataReductionProxySettings* Settings(); |
+ base::WeakPtrFactory<DataReductionProxySettingsAndroid> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); |
}; |