Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2e64eb95def488ee3712b212a6d306387a16c6ca |
| --- /dev/null |
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h |
| @@ -0,0 +1,111 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
| +#define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
| + |
| +#include "base/android/jni_helper.h" |
| +#include "base/android/jni_string.h" |
| +#include "base/android/scoped_java_ref.h" |
| +#include "base/gtest_prod_util.h" |
| +#include "base/prefs/pref_service.h" |
| +#include "net/base/network_change_notifier.h" |
| +#include "net/url_request/url_fetcher.h" |
| +#include "net/url_request/url_fetcher_delegate.h" |
| + |
| +using base::android::ScopedJavaLocalRef; |
| + |
| +class DataReductionProxySettingsAndroid |
| + : public net::URLFetcherDelegate, |
| + public net::NetworkChangeNotifier::IPAddressObserver { |
| + public: |
| + DataReductionProxySettingsAndroid(JNIEnv* env, jobject obj); |
| + virtual ~DataReductionProxySettingsAndroid(); |
| + |
| + void InitDataReductionProxySettings(JNIEnv* env, jobject obj); |
| + |
| + jboolean IsDataReductionProxyAvailable(JNIEnv* env, jobject obj); |
| + jboolean IsDataReductionProxyPromoAvailable(JNIEnv* env, jobject obj); |
| + ScopedJavaLocalRef<jstring> GetDataReductionProxyOrigin(JNIEnv* env, |
| + jobject obj); |
| + ScopedJavaLocalRef<jstring> GetDataReductionProxyValue(JNIEnv* env, |
| + jobject obj); |
| + |
| + jboolean IsDataReductionProxyEnabled(JNIEnv* env, jobject obj); |
| + void SetDataReductionProxyEnabled(JNIEnv* env, jobject obj,jboolean enabled); |
| + |
| + jlong GetDataReductionLastUpdateTime(JNIEnv* env, jobject obj); |
| + |
| + base::android::ScopedJavaLocalRef<jobject> GetContentLengths(JNIEnv* env, |
| + jobject obj); |
| + ScopedJavaLocalRef<jlongArray> GetDailyOriginalContentLengths(JNIEnv* env, |
| + jobject obj); |
| + ScopedJavaLocalRef<jlongArray> GetDailyReceivedContentLengths(JNIEnv* env, |
| + jobject obj); |
| + |
| + void CheckDataReductionProxy(JNIEnv* env, jobject obj); |
|
nyquist
2013/09/04 02:20:15
Could you document what this method does? Or give
bengr
2013/09/05 02:03:49
Done.
|
| + |
| + static bool Register(JNIEnv* env); |
| + |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest, |
|
nyquist
2013/09/04 02:20:15
Is this needed?
bengr
2013/09/05 02:03:49
Now it is.
On 2013/09/04 02:20:15, nyquist wrote:
|
| + TestBypassRules); |
| + |
| + // net::URLFetcherDelegate: |
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| + |
| + |
| + // NetworkChangeNotifier::IPAddressObserver: |
| + virtual void OnIPAddressChanged() OVERRIDE; |
| + |
| + bool IsDataReductionProxyAvailable(); |
| + bool IsDataReductionProxyPromoAvailable(); |
| + |
| + void AddDefaultProxyBypassRules(); |
| + void AddURLPatternToBypass(const std::string& pattern); |
| + void AddHostPatternToBypass(const std::string& pattern); |
| + void AddPatternToBypass(const std::string& url_or_host, |
| + const std::string& pattern); |
| + void AddHostToBypass(const std::string& host); |
| + void AddURLSubstringToBypass(const std::string& url, int from, int to); |
| + |
| + PrefService* GetPrefService(); |
| + |
| + std::string GetDataReductionProxyOriginHostPort(); |
| + void ResetDataReductionStatistics(); |
| + |
| + void SetProxyPac(bool enable_spdy_proxy, bool at_startup); |
| + |
| + std::string GetProxyCheckURL(); |
| + |
| + ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, |
| + const char* pref_name); |
| + void GetContentLengths(int days, |
| + int64* original_content_length, |
| + int64* received_content_length, |
| + int64* last_update_time); |
| + |
| + void CheckDataReductionProxyIsAvailable(std::string url); |
| + |
| + std::string GetProxyPacScript(); |
| + |
| + std::vector<std::string> bypass_rules_; |
| + |
| + // Indicate whether a user has turned on SPDY proxy auth previously in this |
| + // session. |
| + bool has_turned_on_; |
| + |
| + // Indicate whether a user has turned off SPDY proxy auth previously in this |
| + // session. |
| + bool has_turned_off_; |
| + |
| + bool disabled_by_carrier_; |
| + bool enabled_by_user_; |
| + |
| + scoped_ptr<net::URLFetcher> fetcher_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |