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..45ed0e2b3303cb6fd5109d82a991a7ee76a13c8a |
| --- /dev/null |
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h |
| @@ -0,0 +1,122 @@ |
| +// 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 |
|
mmenke
2013/09/05 21:34:33
Class should be documented, as should most of thes
bengr
2013/09/10 00:56:09
Done.
|
| + : 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); |
| + jboolean IsDataReductionProxyManaged(JNIEnv* env, jobject obj); |
| + void SetDataReductionProxyEnabled(JNIEnv* env, jobject obj,jboolean enabled); |
|
mmenke
2013/09/09 15:40:05
nit: Missing space.
bengr
2013/09/10 00:56:09
Done.
|
| + |
| + 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); |
| + |
| + static bool Register(JNIEnv* env); |
| + |
| + private: |
| + friend class DataReductionProxySettingsAndroidTest; |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest, |
| + TestBypassRules); |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest, |
| + TestFormatURL); |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest, |
| + TestStatistics); |
| + |
| + // 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(); |
| + PrefService* GetLocalState(); |
| + void set_pref_service(PrefService* pref_service); |
| + void set_local_state(PrefService* local_state); |
|
mmenke
2013/09/05 21:34:33
If this is only intended for testing, the name sho
bengr
2013/09/10 00:56:09
Done.
|
| + |
| + |
| + std::string GetDataReductionProxyOriginHostPort(); |
| + void RemoveSchemeAndTrailingSlash(std::string* url); |
| + 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. |
|
mmenke
2013/09/09 15:40:05
I'm not really follow...This is SPDY proxy auth sp
bengr
2013/09/10 00:56:09
Done. The data reduction proxy had been called "SP
|
| + 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_; |
| + PrefService* pref_service_; |
| + PrefService* local_state_; |
|
mmenke
2013/09/05 21:34:33
I don't think it's at all clear what the differenc
mmenke
2013/09/09 15:40:05
Also, if these are only used for unit tests, they
bengr
2013/09/10 00:56:09
Done.
bengr
2013/09/10 00:56:09
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |