OLD | NEW |
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 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
8 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" | 9 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura
tor.h" | 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura
tor.h" |
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 14 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
14 | 15 |
15 using data_reduction_proxy::DataReductionProxyParams; | 16 using data_reduction_proxy::DataReductionProxyParams; |
16 using data_reduction_proxy::DataReductionProxySettings; | 17 using data_reduction_proxy::DataReductionProxySettings; |
17 | 18 |
18 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( | 19 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( |
19 DataReductionProxyParams* params) : DataReductionProxySettings(params) { | 20 DataReductionProxyParams* params) : DataReductionProxySettings(params) { |
20 } | 21 } |
21 | 22 |
22 DataReductionProxyChromeSettings::~DataReductionProxyChromeSettings() { | 23 DataReductionProxyChromeSettings::~DataReductionProxyChromeSettings() { |
23 } | 24 } |
24 | 25 |
25 void DataReductionProxyChromeSettings::InitDataReductionProxySettings( | 26 void DataReductionProxyChromeSettings::InitDataReductionProxySettings( |
26 Profile* profile) { | 27 Profile* profile) { |
27 DCHECK(profile); | 28 DCHECK(profile); |
28 PrefService* prefs = profile->GetPrefs(); | 29 PrefService* prefs = profile->GetPrefs(); |
29 | 30 |
30 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | 31 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> |
31 configurator(new DataReductionProxyChromeConfigurator(prefs)); | 32 configurator(new DataReductionProxyChromeConfigurator(prefs)); |
32 SetProxyConfigurator(configurator.Pass()); | 33 SetProxyConfigurator(configurator.Pass()); |
33 DataReductionProxySettings::InitDataReductionProxySettings( | 34 DataReductionProxySettings::InitDataReductionProxySettings( |
34 prefs, | 35 prefs, |
35 g_browser_process->local_state(), | 36 g_browser_process->local_state(), |
36 ProfileManager::GetActiveUserProfile()->GetRequestContext()); | 37 ProfileManager::GetActiveUserProfile()->GetRequestContext(), |
| 38 base::Bind(&DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial, |
| 39 base::Unretained(this))); |
37 | 40 |
38 SetDataReductionProxyAlternativeEnabled( | 41 SetDataReductionProxyAlternativeEnabled( |
39 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); | 42 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); |
40 } | 43 } |
| 44 |
| 45 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( |
| 46 bool data_reduction_proxy_enabled) { |
| 47 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( |
| 48 "DataReductionProxyEnabled", |
| 49 data_reduction_proxy_enabled ? "true" : "false"); |
| 50 } |
OLD | NEW |