OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/component_updater/component_updater_configurator.h" | 5 #include "chrome/browser/component_updater/component_updater_configurator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/version.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/omaha_query_params/chrome_omaha_query_params_delegate.h
" |
| 17 #include "chrome/common/chrome_version_info.h" |
15 #include "components/component_updater/component_updater_switches.h" | 18 #include "components/component_updater/component_updater_switches.h" |
16 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
17 #include "url/gurl.h" | 20 #include "url/gurl.h" |
18 | 21 |
19 namespace component_updater { | 22 namespace component_updater { |
20 | 23 |
21 namespace { | 24 namespace { |
22 | 25 |
23 // Default time constants. | 26 // Default time constants. |
24 const int kDelayOneMinute = 60; | 27 const int kDelayOneMinute = 60; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual ~ChromeConfigurator() {} | 97 virtual ~ChromeConfigurator() {} |
95 | 98 |
96 virtual int InitialDelay() const OVERRIDE; | 99 virtual int InitialDelay() const OVERRIDE; |
97 virtual int NextCheckDelay() OVERRIDE; | 100 virtual int NextCheckDelay() OVERRIDE; |
98 virtual int StepDelay() const OVERRIDE; | 101 virtual int StepDelay() const OVERRIDE; |
99 virtual int StepDelayMedium() OVERRIDE; | 102 virtual int StepDelayMedium() OVERRIDE; |
100 virtual int MinimumReCheckWait() const OVERRIDE; | 103 virtual int MinimumReCheckWait() const OVERRIDE; |
101 virtual int OnDemandDelay() const OVERRIDE; | 104 virtual int OnDemandDelay() const OVERRIDE; |
102 virtual GURL UpdateUrl() const OVERRIDE; | 105 virtual GURL UpdateUrl() const OVERRIDE; |
103 virtual GURL PingUrl() const OVERRIDE; | 106 virtual GURL PingUrl() const OVERRIDE; |
| 107 virtual base::Version GetBrowserVersion() const OVERRIDE; |
| 108 virtual std::string GetChannel() const OVERRIDE; |
| 109 virtual std::string GetLang() const OVERRIDE; |
| 110 virtual std::string GetOSLongName() const OVERRIDE; |
104 virtual std::string ExtraRequestParams() const OVERRIDE; | 111 virtual std::string ExtraRequestParams() const OVERRIDE; |
105 virtual size_t UrlSizeLimit() const OVERRIDE; | 112 virtual size_t UrlSizeLimit() const OVERRIDE; |
106 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; | 113 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; |
107 virtual bool InProcess() const OVERRIDE; | 114 virtual bool InProcess() const OVERRIDE; |
108 virtual bool DeltasEnabled() const OVERRIDE; | 115 virtual bool DeltasEnabled() const OVERRIDE; |
109 virtual bool UseBackgroundDownloader() const OVERRIDE; | 116 virtual bool UseBackgroundDownloader() const OVERRIDE; |
110 | 117 |
111 private: | 118 private: |
112 net::URLRequestContextGetter* url_request_getter_; | 119 net::URLRequestContextGetter* url_request_getter_; |
113 std::string extra_info_; | 120 std::string extra_info_; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 183 } |
177 | 184 |
178 GURL ChromeConfigurator::UpdateUrl() const { | 185 GURL ChromeConfigurator::UpdateUrl() const { |
179 return GURL(url_source_); | 186 return GURL(url_source_); |
180 } | 187 } |
181 | 188 |
182 GURL ChromeConfigurator::PingUrl() const { | 189 GURL ChromeConfigurator::PingUrl() const { |
183 return pings_enabled_ ? GURL(kPingUrl) : GURL(); | 190 return pings_enabled_ ? GURL(kPingUrl) : GURL(); |
184 } | 191 } |
185 | 192 |
| 193 base::Version ChromeConfigurator::GetBrowserVersion() const { |
| 194 return base::Version(chrome::VersionInfo().Version()); |
| 195 } |
| 196 |
| 197 std::string ChromeConfigurator::GetChannel() const { |
| 198 return ChromeOmahaQueryParamsDelegate::GetChannelString(); |
| 199 } |
| 200 |
| 201 std::string ChromeConfigurator::GetLang() const { |
| 202 return ChromeOmahaQueryParamsDelegate::GetLang(); |
| 203 } |
| 204 |
| 205 std::string ChromeConfigurator::GetOSLongName() const { |
| 206 return chrome::VersionInfo().OSType(); |
| 207 } |
| 208 |
186 std::string ChromeConfigurator::ExtraRequestParams() const { | 209 std::string ChromeConfigurator::ExtraRequestParams() const { |
187 return extra_info_; | 210 return extra_info_; |
188 } | 211 } |
189 | 212 |
190 size_t ChromeConfigurator::UrlSizeLimit() const { | 213 size_t ChromeConfigurator::UrlSizeLimit() const { |
191 return 1024ul; | 214 return 1024ul; |
192 } | 215 } |
193 | 216 |
194 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { | 217 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { |
195 return url_request_getter_; | 218 return url_request_getter_; |
(...skipping 11 matching lines...) Expand all Loading... |
207 return background_downloads_enabled_; | 230 return background_downloads_enabled_; |
208 } | 231 } |
209 | 232 |
210 Configurator* MakeChromeComponentUpdaterConfigurator( | 233 Configurator* MakeChromeComponentUpdaterConfigurator( |
211 const base::CommandLine* cmdline, | 234 const base::CommandLine* cmdline, |
212 net::URLRequestContextGetter* context_getter) { | 235 net::URLRequestContextGetter* context_getter) { |
213 return new ChromeConfigurator(cmdline, context_getter); | 236 return new ChromeConfigurator(cmdline, context_getter); |
214 } | 237 } |
215 | 238 |
216 } // namespace component_updater | 239 } // namespace component_updater |
OLD | NEW |