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

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

Issue 373153003: Bypass data reduction proxy when using VPN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/net_util.h"
19 #include "net/base/network_change_notifier.h" 20 #include "net/base/network_change_notifier.h"
20 #include "net/url_request/url_fetcher_delegate.h" 21 #include "net/url_request/url_fetcher_delegate.h"
21 22
22 class PrefService; 23 class PrefService;
23 24
24 namespace net { 25 namespace net {
25 class HostPortPair; 26 class HostPortPair;
26 class HttpNetworkSession; 27 class HttpNetworkSession;
27 class HttpResponseHeaders; 28 class HttpResponseHeaders;
28 class URLFetcher; 29 class URLFetcher;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Metrics method. Subclasses should override if they wish to provide 202 // Metrics method. Subclasses should override if they wish to provide
202 // alternatives. 203 // alternatives.
203 virtual void RecordDataReductionInit(); 204 virtual void RecordDataReductionInit();
204 205
205 virtual void AddDefaultProxyBypassRules(); 206 virtual void AddDefaultProxyBypassRules();
206 207
207 // Writes a warning to the log that is used in backend processing of 208 // Writes a warning to the log that is used in backend processing of
208 // customer feedback. Virtual so tests can mock it for verification. 209 // customer feedback. Virtual so tests can mock it for verification.
209 virtual void LogProxyState(bool enabled, bool restricted, bool at_startup); 210 virtual void LogProxyState(bool enabled, bool restricted, bool at_startup);
210 211
211 // Virtualized for mocking 212 // Virtualized for mocking. Records UMA containing the result of requesting
213 // the probe URL.
212 virtual void RecordProbeURLFetchResult( 214 virtual void RecordProbeURLFetchResult(
213 data_reduction_proxy::ProbeURLFetchResult result); 215 data_reduction_proxy::ProbeURLFetchResult result);
216
217 // Virtualized for mocking. Records UMA specifying whether the proxy was
218 // enabled or disabled at startup.
214 virtual void RecordStartupState( 219 virtual void RecordStartupState(
215 data_reduction_proxy::ProxyStartupState state); 220 data_reduction_proxy::ProxyStartupState state);
216 221
222 // Virtualized for mocking. Returns the list of network interfaces in use.
223 virtual void GetNetworkList(net::NetworkInterfaceList* interfaces,
224 int policy);
225
217 DataReductionProxyConfigurator* configurator() { 226 DataReductionProxyConfigurator* configurator() {
218 return configurator_.get(); 227 return configurator_.get();
219 } 228 }
220 229
221 // Reset params for tests. 230 // Reset params for tests.
222 void ResetParamsForTest(DataReductionProxyParams* params); 231 void ResetParamsForTest(DataReductionProxyParams* params);
223 232
224 private: 233 private:
225 friend class DataReductionProxySettingsTestBase; 234 friend class DataReductionProxySettingsTestBase;
226 friend class DataReductionProxySettingsTest; 235 friend class DataReductionProxySettingsTest;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void MaybeActivateDataReductionProxy(bool at_startup); 275 void MaybeActivateDataReductionProxy(bool at_startup);
267 276
268 // Requests the proxy probe URL, if one is set. If unable to do so, disables 277 // Requests the proxy probe URL, if one is set. If unable to do so, disables
269 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe 278 // the proxy, if enabled. Otherwise enables the proxy if disabled by a probe
270 // failure. 279 // failure.
271 void ProbeWhetherDataReductionProxyIsAvailable(); 280 void ProbeWhetherDataReductionProxyIsAvailable();
272 281
273 // Warms the connection to the data reduction proxy. 282 // Warms the connection to the data reduction proxy.
274 void WarmProxyConnection(); 283 void WarmProxyConnection();
275 284
285 // Disables use of the data reduction proxy on VPNs. Returns true if the
286 // data reduction proxy has been disabled.
287 bool DisableIfVPN();
288
276 // Generic method to get a URL fetcher. 289 // Generic method to get a URL fetcher.
277 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags); 290 net::URLFetcher* GetBaseURLFetcher(const GURL& gurl, int load_flags);
278 291
279 // Returns a UTF16 string that's the hash of the configured authentication
280 // |key| and |salt|. Returns an empty UTF16 string if no key is configured or
281 // the data reduction proxy feature isn't available.
282 static base::string16 AuthHashForSalt(int64 salt,
283 const std::string& key);
284
285 std::string key_; 292 std::string key_;
286 bool restricted_by_carrier_; 293 bool restricted_by_carrier_;
287 bool enabled_by_user_; 294 bool enabled_by_user_;
295 bool disabled_on_vpn_;
288 296
289 scoped_ptr<net::URLFetcher> fetcher_; 297 scoped_ptr<net::URLFetcher> fetcher_;
290 scoped_ptr<net::URLFetcher> warmup_fetcher_; 298 scoped_ptr<net::URLFetcher> warmup_fetcher_;
291 299
292 BooleanPrefMember spdy_proxy_auth_enabled_; 300 BooleanPrefMember spdy_proxy_auth_enabled_;
293 BooleanPrefMember data_reduction_proxy_alternative_enabled_; 301 BooleanPrefMember data_reduction_proxy_alternative_enabled_;
294 302
295 PrefService* prefs_; 303 PrefService* prefs_;
296 PrefService* local_state_prefs_; 304 PrefService* local_state_prefs_;
297 305
298 net::URLRequestContextGetter* url_request_context_getter_; 306 net::URLRequestContextGetter* url_request_context_getter_;
299 307
300 scoped_ptr<DataReductionProxyConfigurator> configurator_; 308 scoped_ptr<DataReductionProxyConfigurator> configurator_;
301 309
302 base::ThreadChecker thread_checker_; 310 base::ThreadChecker thread_checker_;
303 311
304 scoped_ptr<DataReductionProxyParams> params_; 312 scoped_ptr<DataReductionProxyParams> params_;
305 DataReductionProxyUsageStats* usage_stats_; 313 DataReductionProxyUsageStats* usage_stats_;
306 314
307 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); 315 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings);
308 }; 316 };
309 317
310 } // namespace data_reduction_proxy 318 } // namespace data_reduction_proxy
311 319
312 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_ 320 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_SETTINGS _H_
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698