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

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

Issue 449973002: Use data reduction proxy when managed proxy config returns direct (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-uma-in-proxy-service
Patch Set: Addressed comment and nit Created 6 years, 4 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 CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_ 5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_ 6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/task_runner.h"
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h"
14 #include "net/proxy/proxy_config.h"
15
Ryan Sleevi 2014/08/14 19:19:51 IWYU: You need to include "base/memory/ref_counted
16 namespace base {
17 class SequencedTaskRunner;
18 }
19
20 namespace net {
21 class ProxyInfo;
22 class ProxyService;
23 }
13 24
14 class PrefService; 25 class PrefService;
15 26
16 class DataReductionProxyChromeConfigurator 27 class DataReductionProxyChromeConfigurator
17 : public data_reduction_proxy::DataReductionProxyConfigurator { 28 : public data_reduction_proxy::DataReductionProxyConfigurator {
18 public: 29 public:
19 explicit DataReductionProxyChromeConfigurator(PrefService* prefs); 30 explicit DataReductionProxyChromeConfigurator(
31 PrefService* prefs,
32 scoped_refptr<base::SequencedTaskRunner> network_task_runner);
Ryan Sleevi 2014/08/14 19:19:51 This should be a const-ref scoped_refptr scoped_p
20 virtual ~DataReductionProxyChromeConfigurator(); 33 virtual ~DataReductionProxyChromeConfigurator();
21 34
22 virtual void Enable(bool primary_restricted, 35 virtual void Enable(bool primary_restricted,
23 bool fallback_restricted, 36 bool fallback_restricted,
24 const std::string& primary_origin, 37 const std::string& primary_origin,
25 const std::string& fallback_origin, 38 const std::string& fallback_origin,
26 const std::string& ssl_origin) OVERRIDE; 39 const std::string& ssl_origin) OVERRIDE;
27 virtual void Disable() OVERRIDE; 40 virtual void Disable() OVERRIDE;
28 41
29 // Add a host pattern to bypass. This should follow the same syntax used 42 // Add a host pattern to bypass. This should follow the same syntax used
30 // in net::ProxyBypassRules; that is, a hostname pattern, a hostname suffix 43 // in net::ProxyBypassRules; that is, a hostname pattern, a hostname suffix
31 // pattern, an IP literal, a CIDR block, or the magic string '<local>'. 44 // pattern, an IP literal, a CIDR block, or the magic string '<local>'.
32 // Bypass settings persist for the life of this object and are applied 45 // Bypass settings persist for the life of this object and are applied
33 // each time the proxy is enabled, but are not updated while it is enabled. 46 // each time the proxy is enabled, but are not updated while it is enabled.
34 virtual void AddHostPatternToBypass(const std::string& pattern) OVERRIDE; 47 virtual void AddHostPatternToBypass(const std::string& pattern) OVERRIDE;
35 48
36 // Add a URL pattern to bypass the proxy. The base implementation strips 49 // Add a URL pattern to bypass the proxy. The base implementation strips
37 // everything in |pattern| after the first single slash and then treats it 50 // everything in |pattern| after the first single slash and then treats it
38 // as a hostname pattern. Subclasses may implement other semantics. 51 // as a hostname pattern. Subclasses may implement other semantics.
39 virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE; 52 virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE;
40 53
54 // Updates the config for use on the IO thread.
Ryan Sleevi 2014/08/14 19:19:51 So, this generally represents a dangerous design p
55 void UpdateProxyConfigOnIO(const net::ProxyConfig& config);
56
57 // Returns the current data reduction proxy config, even if it is not the
58 // effective configuration used by the proxy service.
59 const net::ProxyConfig& GetProxyConfigOnIO() const;
60
41 private: 61 private:
42 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, TestBypassList); 62 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, TestBypassList);
43 63
44 PrefService* prefs_; 64 PrefService* prefs_;
65 scoped_refptr<base::SequencedTaskRunner> network_task_runner_;
66
45 std::vector<std::string> bypass_rules_; 67 std::vector<std::string> bypass_rules_;
68 net::ProxyConfig config_;
46 69
47 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeConfigurator); 70 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeConfigurator);
48 }; 71 };
49 72
50 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR _H_ 73 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698