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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings.h

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: errata Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/pref_member.h" 14 #include "base/prefs/pref_member.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" 16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h"
17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" 18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h"
19 #include "net/base/network_change_notifier.h" 19 #include "net/base/network_change_notifier.h"
20 #include "net/url_request/url_fetcher_delegate.h" 20 #include "net/url_request/url_fetcher_delegate.h"
21 21
22 class PrefService; 22 class PrefService;
23 23
24 namespace net { 24 namespace net {
25 class AuthChallengeInfo;
26 class HostPortPair; 25 class HostPortPair;
27 class HttpAuthCache;
28 class HttpNetworkSession; 26 class HttpNetworkSession;
29 class HttpResponseHeaders; 27 class HttpResponseHeaders;
30 class URLFetcher; 28 class URLFetcher;
31 class URLRequestContextGetter; 29 class URLRequestContextGetter;
32 } 30 }
33 31
34 namespace data_reduction_proxy { 32 namespace data_reduction_proxy {
35 33
36 // The number of days of bandwidth usage statistics that are tracked. 34 // The number of days of bandwidth usage statistics that are tracked.
37 const unsigned int kNumDaysInHistory = 60; 35 const unsigned int kNumDaysInHistory = 60;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 PrefService* prefs, 118 PrefService* prefs,
121 PrefService* local_state_prefs, 119 PrefService* local_state_prefs,
122 net::URLRequestContextGetter* url_request_context_getter, 120 net::URLRequestContextGetter* url_request_context_getter,
123 scoped_ptr<DataReductionProxyConfigurator> configurator); 121 scoped_ptr<DataReductionProxyConfigurator> configurator);
124 122
125 // Sets the logic the embedder uses to set the networking configuration that 123 // Sets the logic the embedder uses to set the networking configuration that
126 // causes traffic to be proxied. 124 // causes traffic to be proxied.
127 void SetProxyConfigurator( 125 void SetProxyConfigurator(
128 scoped_ptr<DataReductionProxyConfigurator> configurator); 126 scoped_ptr<DataReductionProxyConfigurator> configurator);
129 127
130 // If proxy authentication is compiled in, pre-cache authentication
131 // keys for all configured proxies in |session|.
132 static void InitDataReductionProxySession(
133 net::HttpNetworkSession* session,
134 const DataReductionProxyParams* params);
135
136 // Returns true if |auth_info| represents an authentication challenge from
137 // a compatible, configured proxy.
138 bool IsAcceptableAuthChallenge(net::AuthChallengeInfo* auth_info);
139
140 // Returns a UTF16 string suitable for use as an authentication token in
141 // response to the challenge represented by |auth_info|. If the token can't
142 // be correctly generated for |auth_info|, returns an empty UTF16 string.
143 base::string16 GetTokenForAuthChallenge(net::AuthChallengeInfo* auth_info);
144
145 // Returns true if the proxy is enabled. 128 // Returns true if the proxy is enabled.
146 bool IsDataReductionProxyEnabled(); 129 bool IsDataReductionProxyEnabled();
147 130
148 // Returns true if the alternative proxy is enabled. 131 // Returns true if the alternative proxy is enabled.
149 bool IsDataReductionProxyAlternativeEnabled() const; 132 bool IsDataReductionProxyAlternativeEnabled() const;
150 133
151 // Returns true if the proxy is managed by an adminstrator's policy. 134 // Returns true if the proxy is managed by an adminstrator's policy.
152 bool IsDataReductionProxyManaged(); 135 bool IsDataReductionProxyManaged();
153 136
154 // Enables or disables the data reduction proxy. If a probe URL is available, 137 // Enables or disables the data reduction proxy. If a probe URL is available,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 251 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
269 TestBypassList); 252 TestBypassList);
270 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 253 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
271 CheckInitMetricsWhenNotAllowed); 254 CheckInitMetricsWhenNotAllowed);
272 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 255 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
273 TestSetProxyConfigs); 256 TestSetProxyConfigs);
274 257
275 // NetworkChangeNotifier::IPAddressObserver: 258 // NetworkChangeNotifier::IPAddressObserver:
276 virtual void OnIPAddressChanged() OVERRIDE; 259 virtual void OnIPAddressChanged() OVERRIDE;
277 260
278 // Underlying implementation of InitDataReductionProxySession(), factored
279 // out to be testable without creating a full HttpNetworkSession.
280 static void InitDataReductionAuthentication(
281 net::HttpAuthCache* auth_cache,
282 const DataReductionProxyParams* params);
283
284 void OnProxyEnabledPrefChange(); 261 void OnProxyEnabledPrefChange();
285 void OnProxyAlternativeEnabledPrefChange(); 262 void OnProxyAlternativeEnabledPrefChange();
286 263
287 void ResetDataReductionStatistics(); 264 void ResetDataReductionStatistics();
288 265
289 void MaybeActivateDataReductionProxy(bool at_startup); 266 void MaybeActivateDataReductionProxy(bool at_startup);
290 267
291 // Requests the proxy probe URL, if one is set. If unable to do so, disables 268 // Requests the proxy probe URL, if one is set. If unable to do so, disables
292 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe 269 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe
293 // failure. 270 // failure.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 303
327 scoped_ptr<DataReductionProxyParams> params_; 304 scoped_ptr<DataReductionProxyParams> params_;
328 DataReductionProxyUsageStats* usage_stats_; 305 DataReductionProxyUsageStats* usage_stats_;
329 306
330 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); 307 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings);
331 }; 308 };
332 309
333 } // namespace data_reduction_proxy 310 } // namespace data_reduction_proxy
334 311
335 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_ 312 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698