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. In both of the following, |
| 62 // a net::AuthChallengeInfo object is created from |host| and |realm| and |
| 63 // passed in to the superclass method. |
| 64 jboolean IsAcceptableAuthChallenge(JNIEnv* env, |
| 65 jobject obj, |
| 66 jstring host, |
| 67 jstring realm); |
| 68 |
| 69 ScopedJavaLocalRef<jstring> GetTokenForAuthChallenge(JNIEnv* env, |
| 70 jobject obj, |
| 71 jstring host, |
| 72 jstring realm); |
| 73 |
64 // Registers the native methods to be call from Java. | 74 // Registers the native methods to be call from Java. |
65 static bool Register(JNIEnv* env); | 75 static bool Register(JNIEnv* env); |
66 | 76 |
67 protected: | 77 protected: |
68 // DataReductionProxySettings overrides. | 78 // DataReductionProxySettings overrides. |
69 virtual void AddDefaultProxyBypassRules() OVERRIDE; | 79 virtual void AddDefaultProxyBypassRules() OVERRIDE; |
70 | 80 |
71 // Configures the proxy settings by generating a data URL containing a PAC | 81 // Configures the proxy settings by generating a data URL containing a PAC |
72 // file. | 82 // file. |
73 virtual void SetProxyConfigs(bool enabled, bool at_startup) OVERRIDE; | 83 virtual void SetProxyConfigs(bool enabled, bool at_startup) OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
87 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, | 97 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, |
88 const char* pref_name); | 98 const char* pref_name); |
89 std::string GetProxyPacScript(); | 99 std::string GetProxyPacScript(); |
90 | 100 |
91 std::vector<std::string> pac_bypass_rules_; | 101 std::vector<std::string> pac_bypass_rules_; |
92 | 102 |
93 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); | 103 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); |
94 }; | 104 }; |
95 | 105 |
96 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ | 106 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ |
OLD | NEW |