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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_
11 #include "base/gtest_prod_util.h"
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configurator.h"
16 class DataReductionProxyChromeConfigurator
17 : public data_reduction_proxy::DataReductionProxyConfigurator {
19 explicit DataReductionProxyChromeConfigurator(PrefService* prefs);
20 virtual ~DataReductionProxyChromeConfigurator();
22 virtual void Enable(bool primary_restricted,
23 bool fallback_restricted,
24 const std::string& primary_origin,
25 const std::string& fallback_origin) OVERRIDE;
26 virtual void Disable() OVERRIDE;
28 // Add a host pattern to bypass. This should follow the same syntax used
29 // in net::ProxyBypassRules; that is, a hostname pattern, a hostname suffix
30 // pattern, an IP literal, a CIDR block, or the magic string '<local>'.
31 // Bypass settings persist for the life of this object and are applied
32 // each time the proxy is enabled, but are not updated while it is enabled.
33 virtual void AddHostPatternToBypass(const std::string& pattern) OVERRIDE;
35 // Add a URL pattern to bypass the proxy. The base implementation strips
36 // everything in |pattern| after the first single slash and then treats it
37 // as a hostname pattern. Subclasses may implement other semantics.
38 virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE;
41 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, TestBypassList);
44 std::vector<std::string> bypass_rules_;
46 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeConfigurator);
49 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_