Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | |
| 6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | |
| 7 | |
| 8 #include "base/android/jni_helper.h" | |
| 9 #include "base/android/jni_string.h" | |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 #include "base/prefs/pref_service.h" | |
| 13 #include "net/base/network_change_notifier.h" | |
| 14 #include "net/url_request/url_fetcher.h" | |
| 15 #include "net/url_request/url_fetcher_delegate.h" | |
| 16 | |
| 17 using base::android::ScopedJavaLocalRef; | |
| 18 | |
| 19 class DataReductionProxySettingsAndroid | |
| 20 : public net::URLFetcherDelegate, | |
| 21 public net::NetworkChangeNotifier::IPAddressObserver { | |
| 22 public: | |
| 23 DataReductionProxySettingsAndroid(JNIEnv* env, jobject obj); | |
| 24 virtual ~DataReductionProxySettingsAndroid(); | |
| 25 | |
| 26 void InitDataReductionProxySettings(JNIEnv* env, jobject obj); | |
| 27 | |
| 28 jboolean IsDataReductionProxyAvailable(JNIEnv* env, jobject obj); | |
| 29 jboolean IsDataReductionProxyPromoAvailable(JNIEnv* env, jobject obj); | |
| 30 ScopedJavaLocalRef<jstring> GetDataReductionProxyOrigin(JNIEnv* env, | |
| 31 jobject obj); | |
| 32 ScopedJavaLocalRef<jstring> GetDataReductionProxyValue(JNIEnv* env, | |
| 33 jobject obj); | |
| 34 | |
| 35 jboolean IsDataReductionProxyEnabled(JNIEnv* env, jobject obj); | |
| 36 void SetDataReductionProxyEnabled(JNIEnv* env, jobject obj,jboolean enabled); | |
| 37 | |
| 38 jlong GetDataReductionLastUpdateTime(JNIEnv* env, jobject obj); | |
| 39 | |
| 40 base::android::ScopedJavaLocalRef<jobject> GetContentLengths(JNIEnv* env, | |
| 41 jobject obj); | |
| 42 ScopedJavaLocalRef<jlongArray> GetDailyOriginalContentLengths(JNIEnv* env, | |
| 43 jobject obj); | |
| 44 ScopedJavaLocalRef<jlongArray> GetDailyReceivedContentLengths(JNIEnv* env, | |
| 45 jobject obj); | |
| 46 | |
| 47 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.
| |
| 48 | |
| 49 static bool Register(JNIEnv* env); | |
| 50 | |
| 51 private: | |
| 52 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:
| |
| 53 TestBypassRules); | |
| 54 | |
| 55 // net::URLFetcherDelegate: | |
| 56 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | |
| 57 | |
| 58 | |
| 59 // NetworkChangeNotifier::IPAddressObserver: | |
| 60 virtual void OnIPAddressChanged() OVERRIDE; | |
| 61 | |
| 62 bool IsDataReductionProxyAvailable(); | |
| 63 bool IsDataReductionProxyPromoAvailable(); | |
| 64 | |
| 65 void AddDefaultProxyBypassRules(); | |
| 66 void AddURLPatternToBypass(const std::string& pattern); | |
| 67 void AddHostPatternToBypass(const std::string& pattern); | |
| 68 void AddPatternToBypass(const std::string& url_or_host, | |
| 69 const std::string& pattern); | |
| 70 void AddHostToBypass(const std::string& host); | |
| 71 void AddURLSubstringToBypass(const std::string& url, int from, int to); | |
| 72 | |
| 73 PrefService* GetPrefService(); | |
| 74 | |
| 75 std::string GetDataReductionProxyOriginHostPort(); | |
| 76 void ResetDataReductionStatistics(); | |
| 77 | |
| 78 void SetProxyPac(bool enable_spdy_proxy, bool at_startup); | |
| 79 | |
| 80 std::string GetProxyCheckURL(); | |
| 81 | |
| 82 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, | |
| 83 const char* pref_name); | |
| 84 void GetContentLengths(int days, | |
| 85 int64* original_content_length, | |
| 86 int64* received_content_length, | |
| 87 int64* last_update_time); | |
| 88 | |
| 89 void CheckDataReductionProxyIsAvailable(std::string url); | |
| 90 | |
| 91 std::string GetProxyPacScript(); | |
| 92 | |
| 93 std::vector<std::string> bypass_rules_; | |
| 94 | |
| 95 // Indicate whether a user has turned on SPDY proxy auth previously in this | |
| 96 // session. | |
| 97 bool has_turned_on_; | |
| 98 | |
| 99 // Indicate whether a user has turned off SPDY proxy auth previously in this | |
| 100 // session. | |
| 101 bool has_turned_off_; | |
| 102 | |
| 103 bool disabled_by_carrier_; | |
| 104 bool enabled_by_user_; | |
| 105 | |
| 106 scoped_ptr<net::URLFetcher> fetcher_; | |
| 107 | |
| 108 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); | |
| 109 }; | |
| 110 | |
| 111 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | |
| OLD | NEW |