| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 10 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 void DataReductionProxyChromeSettings::InitDataReductionProxySettings( | 30 void DataReductionProxyChromeSettings::InitDataReductionProxySettings( |
| 31 data_reduction_proxy::DataReductionProxyConfigurator* configurator, | 31 data_reduction_proxy::DataReductionProxyConfigurator* configurator, |
| 32 PrefService* profile_prefs, | 32 PrefService* profile_prefs, |
| 33 PrefService* local_state_prefs, | 33 PrefService* local_state_prefs, |
| 34 net::URLRequestContextGetter* request_context) { | 34 net::URLRequestContextGetter* request_context) { |
| 35 SetProxyConfigurator(configurator); | 35 SetProxyConfigurator(configurator); |
| 36 DataReductionProxySettings::InitDataReductionProxySettings( | 36 DataReductionProxySettings::InitDataReductionProxySettings( |
| 37 profile_prefs, | 37 profile_prefs, |
| 38 local_state_prefs, | |
| 39 request_context); | 38 request_context); |
| 40 DataReductionProxySettings::SetOnDataReductionEnabledCallback( | 39 DataReductionProxySettings::SetOnDataReductionEnabledCallback( |
| 41 base::Bind(&DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial, | 40 base::Bind(&DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial, |
| 42 base::Unretained(this))); | 41 base::Unretained(this))); |
| 43 SetDataReductionProxyAlternativeEnabled( | 42 SetDataReductionProxyAlternativeEnabled( |
| 44 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); | 43 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( | 46 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( |
| 48 bool data_reduction_proxy_enabled) { | 47 bool data_reduction_proxy_enabled) { |
| 49 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( | 48 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( |
| 50 "DataReductionProxyEnabled", | 49 "DataReductionProxyEnabled", |
| 51 data_reduction_proxy_enabled ? "true" : "false"); | 50 data_reduction_proxy_enabled ? "true" : "false"); |
| 52 } | 51 } |
| 53 | 52 |
| 54 // static | 53 // static |
| 55 std::string DataReductionProxyChromeSettings::GetClient() { | 54 std::string DataReductionProxyChromeSettings::GetClient() { |
| 56 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
| 57 return data_reduction_proxy::kClientChromeAndroid; | 56 return data_reduction_proxy::kClientChromeAndroid; |
| 58 #elif defined(OS_IOS) | 57 #elif defined(OS_IOS) |
| 59 return data_reduction_proxy::kClientChromeIOS; | 58 return data_reduction_proxy::kClientChromeIOS; |
| 60 #else | 59 #else |
| 61 return ""; | 60 return ""; |
| 62 #endif | 61 #endif |
| 63 } | 62 } |
| OLD | NEW |