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/strings/string_split.h" |
7 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 9 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
9 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" | 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/common/chrome_version_info.h" |
| 14 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura
tor.h" | 15 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura
tor.h" |
13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
14 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
15 | 18 |
16 using data_reduction_proxy::DataReductionProxyParams; | 19 using data_reduction_proxy::DataReductionProxyParams; |
17 using data_reduction_proxy::DataReductionProxySettings; | 20 using data_reduction_proxy::DataReductionProxySettings; |
18 | 21 |
19 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( | 22 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( |
20 DataReductionProxyParams* params) : DataReductionProxySettings(params) { | 23 DataReductionProxyParams* params) : DataReductionProxySettings(params) { |
21 } | 24 } |
(...skipping 20 matching lines...) Expand all Loading... |
42 SetDataReductionProxyAlternativeEnabled( | 45 SetDataReductionProxyAlternativeEnabled( |
43 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); | 46 DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); |
44 } | 47 } |
45 | 48 |
46 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( | 49 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( |
47 bool data_reduction_proxy_enabled) { | 50 bool data_reduction_proxy_enabled) { |
48 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( | 51 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( |
49 "DataReductionProxyEnabled", | 52 "DataReductionProxyEnabled", |
50 data_reduction_proxy_enabled ? "true" : "false"); | 53 data_reduction_proxy_enabled ? "true" : "false"); |
51 } | 54 } |
| 55 |
| 56 // static |
| 57 std::string DataReductionProxyChromeSettings::GetBuildAndPatchNumber() { |
| 58 chrome::VersionInfo version_info; |
| 59 std::vector<std::string> version_parts; |
| 60 base::SplitString(version_info.Version(), '.', &version_parts); |
| 61 if (version_parts.size() != 4) |
| 62 return ""; |
| 63 return version_parts[2] + version_parts[3]; |
| 64 } |
| 65 |
| 66 // static |
| 67 std::string DataReductionProxyChromeSettings::GetClient() { |
| 68 #if defined(OS_ANDROID) |
| 69 return data_reduction_proxy::kClientChromeAndroid; |
| 70 #elif defined(OS_IOS) |
| 71 return data_reduction_proxy::kClientChromeIOS; |
| 72 #else |
| 73 return ""; |
| 74 #endif |
| 75 } |
OLD | NEW |