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_SETTINGS_H_
6#define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_SETTINGS_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
10#include "components/keyed_service/core/keyed_service.h"
11
12namespace base {
13class PrefService;
14}
15
16namespace data_reduction_proxy {
17class DataReductionProxyConfigurator;
18class DataReductionProxyParams;
19}
20
21namespace net {
22class URLRequestContextGetter;
23}
24
25class PrefService;
26
27// Data reduction proxy settings class suitable for use with a Chrome browser.
28// It is keyed to a browser context.
29class DataReductionProxyChromeSettings
30    : public data_reduction_proxy::DataReductionProxySettings,
31      public KeyedService {
32 public:
33  // Constructs a settings object with the given configuration parameters.
34  // Construction and destruction must happen on the UI thread.
35  explicit DataReductionProxyChromeSettings(
36      data_reduction_proxy::DataReductionProxyParams* params);
37
38  // Destructs the settings object.
39  virtual ~DataReductionProxyChromeSettings();
40
41  // Initialize the settings object with the given configurator, prefs services,
42  // and request context.
43  void InitDataReductionProxySettings(
44      data_reduction_proxy::DataReductionProxyConfigurator* configurator,
45      PrefService* profile_prefs,
46      PrefService* local_state_prefs,
47      net::URLRequestContextGetter* request_context);
48
49  // Gets the client type for the data reduction proxy.
50  static std::string GetClient();
51
52 private:
53  // Registers the DataReductionProxyEnabled synthetic field trial with
54  // the group |data_reduction_proxy_enabled|.
55  void RegisterSyntheticFieldTrial(bool data_reduction_proxy_enabled);
56
57  DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeSettings);
58};
59
60#endif  // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_SETTINGS_H_
61