Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1718)

Unified Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h

Issue 2781323004: Create a new Data Saver settings page that adds the site breakdown (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};
« no previous file with comments | « chrome/browser/android/chrome_feature_list.cc ('k') | chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698