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 "base/strings/string_split.h" | |
10 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 10 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
12 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" | 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/common/chrome_version_info.h" | |
16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" | 14 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
17 #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" |
18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 16 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 17 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
20 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
21 | 19 |
22 using data_reduction_proxy::DataReductionProxyParams; | 20 using data_reduction_proxy::DataReductionProxyParams; |
23 using data_reduction_proxy::DataReductionProxySettings; | 21 using data_reduction_proxy::DataReductionProxySettings; |
24 | 22 |
25 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( | 23 DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( |
(...skipping 21 matching lines...) Expand all Loading... |
47 } | 45 } |
48 | 46 |
49 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( | 47 void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( |
50 bool data_reduction_proxy_enabled) { | 48 bool data_reduction_proxy_enabled) { |
51 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( | 49 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( |
52 "DataReductionProxyEnabled", | 50 "DataReductionProxyEnabled", |
53 data_reduction_proxy_enabled ? "true" : "false"); | 51 data_reduction_proxy_enabled ? "true" : "false"); |
54 } | 52 } |
55 | 53 |
56 // static | 54 // 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() { | 55 std::string DataReductionProxyChromeSettings::GetClient() { |
68 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
69 return data_reduction_proxy::kClientChromeAndroid; | 57 return data_reduction_proxy::kClientChromeAndroid; |
70 #elif defined(OS_IOS) | 58 #elif defined(OS_IOS) |
71 return data_reduction_proxy::kClientChromeIOS; | 59 return data_reduction_proxy::kClientChromeIOS; |
72 #else | 60 #else |
73 return ""; | 61 return ""; |
74 #endif | 62 #endif |
75 } | 63 } |
OLD | NEW |