Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / net / spdyproxy / data_reduction_proxy_chrome_configurator.h
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.
4
5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/gtest_prod_util.h"
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configurator.h"
13
14 class PrefService;
15
16 class DataReductionProxyChromeConfigurator
17     : public data_reduction_proxy::DataReductionProxyConfigurator {
18  public:
19   explicit DataReductionProxyChromeConfigurator(PrefService* prefs);
20   virtual ~DataReductionProxyChromeConfigurator();
21
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;
27
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;
34
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;
39
40  private:
41   FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, TestBypassList);
42
43   PrefService* prefs_;
44   std::vector<std::string> bypass_rules_;
45
46   DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeConfigurator);
47 };
48
49 #endif  // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_