Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc

Issue 421653005: Adding synthetic field trial for DataReductionProxyEnabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@newPltWithCL
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" 8 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h"
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
14 #include "components/metrics/metrics_service.h"
15 #include "components/variations/metrics_util.h"
14 16
15 using data_reduction_proxy::DataReductionProxyParams; 17 using data_reduction_proxy::DataReductionProxyParams;
16 using data_reduction_proxy::DataReductionProxySettings; 18 using data_reduction_proxy::DataReductionProxySettings;
17 19
18 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( 20 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings(
19 DataReductionProxyParams* params) : DataReductionProxySettings(params) { 21 DataReductionProxyParams* params) : DataReductionProxySettings(params) {
20 } 22 }
21 23
22 DataReductionProxyChromeSettings::~DataReductionProxyChromeSettings() { 24 DataReductionProxyChromeSettings::~DataReductionProxyChromeSettings() {
23 } 25 }
24 26
25 void DataReductionProxyChromeSettings::InitDataReductionProxySettings( 27 void DataReductionProxyChromeSettings::InitDataReductionProxySettings(
26 Profile* profile) { 28 Profile* profile) {
27 DCHECK(profile); 29 DCHECK(profile);
28 PrefService* prefs = profile->GetPrefs(); 30 PrefService* prefs = profile->GetPrefs();
29 31
30 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> 32 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
31 configurator(new DataReductionProxyChromeConfigurator(prefs)); 33 configurator(new DataReductionProxyChromeConfigurator(prefs));
32 SetProxyConfigurator(configurator.Pass()); 34 SetProxyConfigurator(configurator.Pass());
33 DataReductionProxySettings::InitDataReductionProxySettings( 35 DataReductionProxySettings::InitDataReductionProxySettings(
34 prefs, 36 prefs,
35 g_browser_process->local_state(), 37 g_browser_process->local_state(),
36 ProfileManager::GetActiveUserProfile()->GetRequestContext()); 38 ProfileManager::GetActiveUserProfile()->GetRequestContext(),
39 base::Bind(&DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial,
40 base::Unretained(this)));
37 41
38 SetDataReductionProxyAlternativeEnabled( 42 SetDataReductionProxyAlternativeEnabled(
39 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); 43 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial());
40 } 44 }
45
46 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial(
47 bool data_reduction_proxy_enabled) {
48 if (g_browser_process->metrics_service()) {
49 SyntheticTrialGroup trial(
50 metrics::HashName("DataReductionProxyEnabled"),
51 metrics::HashName(data_reduction_proxy_enabled ? "true" : "false"));
52 g_browser_process->metrics_service()->RegisterSyntheticFieldTrial(trial);
53 }
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698