Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / net / spdyproxy / data_reduction_proxy_chrome_settings.h
blob10b5a1fa6a474e5587450bc4d90b08ec8123a2fd
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_SETTINGS_H_
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_SETTINGS_H_
8 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
9 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
10 #include "components/keyed_service/core/keyed_service.h"
12 class PrefService;
14 namespace base {
15 class SequencedTaskRunner;
16 class SingleThreadTaskRunner;
19 namespace data_reduction_proxy {
20 class DataReductionProxyIOData;
21 class DataStore;
24 namespace net {
25 class URLRequestContextGetter;
28 class PrefService;
30 // Data reduction proxy settings class suitable for use with a Chrome browser.
31 // It is keyed to a browser context.
32 class DataReductionProxyChromeSettings
33 : public data_reduction_proxy::DataReductionProxySettings,
34 public KeyedService {
35 public:
36 // Enum values that can be reported for the
37 // DataReductionProxy.ProxyPrefMigrationResult histogram. These values must be
38 // kept in sync with their counterparts in histograms.xml. Visible here for
39 // testing purposes.
40 enum ProxyPrefMigrationResult {
41 PROXY_PREF_NOT_CLEARED = 0,
42 PROXY_PREF_CLEARED_EMPTY,
43 PROXY_PREF_CLEARED_MODE_SYSTEM,
44 PROXY_PREF_CLEARED_DRP,
45 PROXY_PREF_CLEARED_GOOGLEZIP,
46 PROXY_PREF_CLEARED_PAC_GOOGLEZIP,
47 PROXY_PREF_MAX
50 // Constructs a settings object. Construction and destruction must happen on
51 // the UI thread.
52 DataReductionProxyChromeSettings();
54 // Destructs the settings object.
55 ~DataReductionProxyChromeSettings() override;
57 // Overrides KeyedService::Shutdown:
58 void Shutdown() override;
60 // Initialize the settings object with the given io_data, prefs services,
61 // request context getter, data store, ui task runner, and db task runner.
62 void InitDataReductionProxySettings(
63 data_reduction_proxy::DataReductionProxyIOData* io_data,
64 PrefService* profile_prefs,
65 net::URLRequestContextGetter* request_context_getter,
66 scoped_ptr<data_reduction_proxy::DataStore> store,
67 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
68 const scoped_refptr<base::SequencedTaskRunner>& db_task_runner);
70 // Gets the client type for the data reduction proxy.
71 static data_reduction_proxy::Client GetClient();
73 // Public for testing.
74 void MigrateDataReductionProxyOffProxyPrefs(PrefService* prefs);
76 private:
77 // Helper method for migrating the Data Reduction Proxy away from using the
78 // proxy pref. Returns the ProxyPrefMigrationResult value indicating the
79 // migration action taken.
80 ProxyPrefMigrationResult MigrateDataReductionProxyOffProxyPrefsHelper(
81 PrefService* prefs);
83 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeSettings);
86 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_SETTINGS_H_