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 ApplicationVersion() const OVERRIDE; | |
108 virtual std::string GetChannelString() 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::ApplicationVersion() const { | |
194 return base::Version(chrome::VersionInfo().Version()); | |
195 } | |
196 | |
197 | |
Sorin Jianu
2014/07/10 12:27:28
extra empty line
tommycli
2014/07/10 16:08:13
Done.
| |
198 std::string ChromeConfigurator::GetChannelString() const { | |
199 return ChromeOmahaQueryParamsDelegate::GetChannelString(); | |
200 } | |
201 | |
202 std::string ChromeConfigurator::GetLang() const { | |
203 return ChromeOmahaQueryParamsDelegate::GetLang(); | |
204 } | |
205 | |
206 std::string ChromeConfigurator::GetOSLongName() const { | |
207 return chrome::VersionInfo().OSType(); | |
208 } | |
209 | |
186 std::string ChromeConfigurator::ExtraRequestParams() const { | 210 std::string ChromeConfigurator::ExtraRequestParams() const { |
187 return extra_info_; | 211 return extra_info_; |
188 } | 212 } |
189 | 213 |
190 size_t ChromeConfigurator::UrlSizeLimit() const { | 214 size_t ChromeConfigurator::UrlSizeLimit() const { |
191 return 1024ul; | 215 return 1024ul; |
192 } | 216 } |
193 | 217 |
194 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { | 218 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { |
195 return url_request_getter_; | 219 return url_request_getter_; |
(...skipping 11 matching lines...) Expand all Loading... | |
207 return background_downloads_enabled_; | 231 return background_downloads_enabled_; |
208 } | 232 } |
209 | 233 |
210 Configurator* MakeChromeComponentUpdaterConfigurator( | 234 Configurator* MakeChromeComponentUpdaterConfigurator( |
211 const base::CommandLine* cmdline, | 235 const base::CommandLine* cmdline, |
212 net::URLRequestContextGetter* context_getter) { | 236 net::URLRequestContextGetter* context_getter) { |
213 return new ChromeConfigurator(cmdline, context_getter); | 237 return new ChromeConfigurator(cmdline, context_getter); |
214 } | 238 } |
215 | 239 |
216 } // namespace component_updater | 240 } // namespace component_updater |
OLD | NEW |