| 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..4d4750c44ba65d7babf4fbbe33120fe2a68c6c56
|
| --- /dev/null
|
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h
|
| @@ -0,0 +1,121 @@
|
| +// 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);
|
| +
|
| + 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);
|
| +
|
| +
|
| + 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.
|
| + 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_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_
|
|
|