Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
| 6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | 6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_helper.h" | 8 #include "base/android/jni_helper.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 // Central point for configuring the data reduction proxy on Android. | 22 // Central point for configuring the data reduction proxy on Android. |
| 23 // This object lives on the UI thread and all of its methods are expected to | 23 // This object lives on the UI thread and all of its methods are expected to |
| 24 // be called from there. | 24 // be called from there. |
| 25 class DataReductionProxySettingsAndroid : public DataReductionProxySettings { | 25 class DataReductionProxySettingsAndroid : public DataReductionProxySettings { |
| 26 public: | 26 public: |
| 27 DataReductionProxySettingsAndroid(JNIEnv* env, jobject obj); | 27 DataReductionProxySettingsAndroid(JNIEnv* env, jobject obj); |
| 28 virtual ~DataReductionProxySettingsAndroid(); | 28 virtual ~DataReductionProxySettingsAndroid(); |
| 29 | 29 |
| 30 void InitDataReductionProxySettings(JNIEnv* env, jobject obj); | 30 void InitDataReductionProxySettings(JNIEnv* env, jobject obj); |
| 31 | 31 |
| 32 | |
| 33 void BypassHostPattern(JNIEnv* env, jobject obj, jstring pattern); | 32 void BypassHostPattern(JNIEnv* env, jobject obj, jstring pattern); |
| 34 // Add a URL pattern to bypass the proxy. Wildcards | 33 // Add a URL pattern to bypass the proxy. Wildcards |
| 35 // should be compatible with the JavaScript function shExpMatch, which can be | 34 // should be compatible with the JavaScript function shExpMatch, which can be |
| 36 // used in proxy PAC resolution. These functions must only be called before | 35 // used in proxy PAC resolution. These functions must only be called before |
| 37 // the proxy is used. | 36 // the proxy is used. |
| 38 void BypassURLPattern(JNIEnv* env, jobject obj, jstring pattern); | 37 void BypassURLPattern(JNIEnv* env, jobject obj, jstring pattern); |
| 39 | 38 |
| 40 virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE; | 39 virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE; |
| 41 | 40 |
| 42 // JNI wrapper interfaces to the indentically-named superclass methods. | 41 // JNI wrapper interfaces to the indentically-named superclass methods. |
| 43 jboolean IsDataReductionProxyAllowed(JNIEnv* env, jobject obj); | 42 jboolean IsDataReductionProxyAllowed(JNIEnv* env, jobject obj); |
| 44 jboolean IsDataReductionProxyPromoAllowed(JNIEnv* env, jobject obj); | 43 jboolean IsDataReductionProxyPromoAllowed(JNIEnv* env, jobject obj); |
| 45 ScopedJavaLocalRef<jstring> GetDataReductionProxyOrigin(JNIEnv* env, | 44 ScopedJavaLocalRef<jstring> GetDataReductionProxyOrigin(JNIEnv* env, |
| 46 jobject obj); | 45 jobject obj); |
| 47 ScopedJavaLocalRef<jstring> GetDataReductionProxyAuth(JNIEnv* env, | |
| 48 jobject obj); | |
| 49 jboolean IsDataReductionProxyEnabled(JNIEnv* env, jobject obj); | 46 jboolean IsDataReductionProxyEnabled(JNIEnv* env, jobject obj); |
| 50 jboolean IsDataReductionProxyManaged(JNIEnv* env, jobject obj); | 47 jboolean IsDataReductionProxyManaged(JNIEnv* env, jobject obj); |
| 51 void SetDataReductionProxyEnabled(JNIEnv* env, jobject obj, jboolean enabled); | 48 void SetDataReductionProxyEnabled(JNIEnv* env, jobject obj, jboolean enabled); |
| 52 | 49 |
| 53 jlong GetDataReductionLastUpdateTime(JNIEnv* env, jobject obj); | 50 jlong GetDataReductionLastUpdateTime(JNIEnv* env, jobject obj); |
| 54 ScopedJavaLocalRef<jlongArray> GetDailyOriginalContentLengths(JNIEnv* env, | 51 ScopedJavaLocalRef<jlongArray> GetDailyOriginalContentLengths(JNIEnv* env, |
| 55 jobject obj); | 52 jobject obj); |
| 56 ScopedJavaLocalRef<jlongArray> GetDailyReceivedContentLengths(JNIEnv* env, | 53 ScopedJavaLocalRef<jlongArray> GetDailyReceivedContentLengths(JNIEnv* env, |
| 57 jobject obj); | 54 jobject obj); |
| 58 | 55 |
| 59 // Return a Java |ContentLengths| object wrapping the results of a call to | 56 // Return a Java |ContentLengths| object wrapping the results of a call to |
| 60 // DataReductionProxySettings::GetContentLengths. | 57 // DataReductionProxySettings::GetContentLengths. |
| 61 base::android::ScopedJavaLocalRef<jobject> GetContentLengths(JNIEnv* env, | 58 base::android::ScopedJavaLocalRef<jobject> GetContentLengths(JNIEnv* env, |
| 62 jobject obj); | 59 jobject obj); |
| 63 | 60 |
| 61 // Wrapper methods for handling auth challenges. | |
| 62 jboolean IsAcceptableAuthChallenge(JNIEnv* env, | |
| 63 jobject obj, | |
| 64 jstring host, | |
| 65 jstring realm); | |
| 66 ScopedJavaLocalRef<jstring> GetTokenForAuthChallenge(JNIEnv* env, | |
|
bengr
2013/10/22 01:02:09
add blank line.
marq (ping after 24h)
2013/10/22 14:44:20
Done.
| |
| 67 jobject obj, | |
| 68 jstring host, | |
| 69 jstring realm); | |
| 70 | |
| 64 // Registers the native methods to be call from Java. | 71 // Registers the native methods to be call from Java. |
| 65 static bool Register(JNIEnv* env); | 72 static bool Register(JNIEnv* env); |
| 66 | 73 |
| 67 protected: | 74 protected: |
| 68 // DataReductionProxySettings overrides. | 75 // DataReductionProxySettings overrides. |
| 69 virtual void AddDefaultProxyBypassRules() OVERRIDE; | 76 virtual void AddDefaultProxyBypassRules() OVERRIDE; |
| 70 | 77 |
| 71 // Configures the proxy settings by generating a data URL containing a PAC | 78 // Configures the proxy settings by generating a data URL containing a PAC |
| 72 // file. | 79 // file. |
| 73 virtual void SetProxyConfigs(bool enabled, bool at_startup) OVERRIDE; | 80 virtual void SetProxyConfigs(bool enabled, bool at_startup) OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 87 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, | 94 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, |
| 88 const char* pref_name); | 95 const char* pref_name); |
| 89 std::string GetProxyPacScript(); | 96 std::string GetProxyPacScript(); |
| 90 | 97 |
| 91 std::vector<std::string> pac_bypass_rules_; | 98 std::vector<std::string> pac_bypass_rules_; |
| 92 | 99 |
| 93 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); | 100 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); |
| 94 }; | 101 }; |
| 95 | 102 |
| 96 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | 103 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
| OLD | NEW |