Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/prefs/pref_member.h" 15 #include "base/prefs/pref_member.h"
16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
17 17 #include "components/keyed_service/core/keyed_service.h"
18 18
19 using base::android::ScopedJavaLocalRef; 19 using base::android::ScopedJavaLocalRef;
20 20
21 class Profile;
22
23 namespace data_reduction_proxy {
24 class DataReductionProxyParams;
25 }
21 26
22 // Central point for configuring the data reduction proxy on Android. 27 // 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 28 // This object lives on the UI thread and all of its methods are expected to
24 // be called from there. 29 // be called from there.
25 class DataReductionProxySettingsAndroid 30 class DataReductionProxySettingsAndroid
26 : public data_reduction_proxy::DataReductionProxySettings { 31 : public data_reduction_proxy::DataReductionProxySettings,
32 public KeyedService {
27 public: 33 public:
28 DataReductionProxySettingsAndroid(JNIEnv* env, jobject obj); 34 // Factory constructor.
29 // Parameter-free constructor for C++ unit tests. 35 DataReductionProxySettingsAndroid(
30 DataReductionProxySettingsAndroid(); 36 data_reduction_proxy::DataReductionProxyParams* params);
37
31 38
32 virtual ~DataReductionProxySettingsAndroid(); 39 virtual ~DataReductionProxySettingsAndroid();
33 40
34 void InitDataReductionProxySettings(JNIEnv* env, jobject obj); 41 void InitDataReductionProxySettings(Profile* profile);
35 42
36 void BypassHostPattern(JNIEnv* env, jobject obj, jstring pattern); 43 void BypassHostPattern(JNIEnv* env, jobject obj, jstring pattern);
37 // Add a URL pattern to bypass the proxy. Wildcards 44 // Add a URL pattern to bypass the proxy. Wildcards
38 // should be compatible with the JavaScript function shExpMatch, which can be 45 // should be compatible with the JavaScript function shExpMatch, which can be
39 // used in proxy PAC resolution. These functions must only be called before 46 // used in proxy PAC resolution. These functions must only be called before
40 // the proxy is used. 47 // the proxy is used.
41 void BypassURLPattern(JNIEnv* env, jobject obj, jstring pattern); 48 void BypassURLPattern(JNIEnv* env, jobject obj, jstring pattern);
42 49
43 // JNI wrapper interfaces to the indentically-named superclass methods. 50 // JNI wrapper interfaces to the indentically-named superclass methods.
44 jboolean IsDataReductionProxyAllowed(JNIEnv* env, jobject obj); 51 jboolean IsDataReductionProxyAllowed(JNIEnv* env, jobject obj);
(...skipping 30 matching lines...) Expand all
75 82
76 // Registers the native methods to be call from Java. 83 // Registers the native methods to be call from Java.
77 static bool Register(JNIEnv* env); 84 static bool Register(JNIEnv* env);
78 85
79 protected: 86 protected:
80 // DataReductionProxySettings overrides. 87 // DataReductionProxySettings overrides.
81 virtual void AddDefaultProxyBypassRules() OVERRIDE; 88 virtual void AddDefaultProxyBypassRules() OVERRIDE;
82 89
83 // Configures the proxy settings by generating a data URL containing a PAC 90 // Configures the proxy settings by generating a data URL containing a PAC
84 // file. 91 // file.
85 virtual void SetProxyConfigs( 92 virtual void SetProxyConfigs(bool enabled,
86 bool enabled, bool restricted, bool at_startup) OVERRIDE; 93 bool alt_enabled,
94 bool restricted,
95 bool at_startup) OVERRIDE;
87 96
88 private: 97 private:
89 friend class DataReductionProxySettingsAndroidTest; 98 friend class DataReductionProxySettingsAndroidTest;
90 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest, 99 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsAndroidTest,
91 TestGetDailyContentLengths); 100 TestGetDailyContentLengths);
92 101
93 102
94 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env, 103 ScopedJavaLocalRef<jlongArray> GetDailyContentLengths(JNIEnv* env,
95 const char* pref_name); 104 const char* pref_name);
96 105
97 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid); 106 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettingsAndroid);
98 }; 107 };
99 108
100 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_ 109 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_SETTINGS_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698