| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const char kSwitchFastUpdate[] = "fast-update"; | 33 const char kSwitchFastUpdate[] = "fast-update"; |
| 34 // Add "testrequest=1" parameter to the update check query. | 34 // Add "testrequest=1" parameter to the update check query. |
| 35 const char kSwitchRequestParam[] = "test-request"; | 35 const char kSwitchRequestParam[] = "test-request"; |
| 36 // Disables pings. Pings are the requests sent to the update server that report | 36 // Disables pings. Pings are the requests sent to the update server that report |
| 37 // the success or the failure of component install or update attempts. | 37 // the success or the failure of component install or update attempts. |
| 38 extern const char kSwitchDisablePings[] = "disable-pings"; | 38 extern const char kSwitchDisablePings[] = "disable-pings"; |
| 39 | 39 |
| 40 // Sets the URL for updates. | 40 // Sets the URL for updates. |
| 41 const char kSwitchUrlSource[] = "url-source"; | 41 const char kSwitchUrlSource[] = "url-source"; |
| 42 | 42 |
| 43 // The default url from which an update manifest can be fetched. Can be | 43 // The default url for the v3 protocol service endpoint. Can be |
| 44 // overridden with --component-updater=url-source=someurl. | 44 // overridden with --component-updater=url-source=someurl. |
| 45 const char kDefaultUrlSource[] = | 45 const char kDefaultUrlSource[] = |
| 46 "http://clients2.google.com/service/update2/crx"; | 46 "http://clients2.google.com/service/update2"; |
| 47 | |
| 48 // The url to send the pings to. | |
| 49 const char kPingUrl[] = "http://tools.google.com/service/update2"; | |
| 50 | 47 |
| 51 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 52 // Disables differential updates. | 49 // Disables differential updates. |
| 53 const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates"; | 50 const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates"; |
| 54 #endif // defined(OS_WIN) | 51 #endif // defined(OS_WIN) |
| 55 | 52 |
| 56 // Returns true if and only if |test| is contained in |vec|. | 53 // Returns true if and only if |test| is contained in |vec|. |
| 57 bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) { | 54 bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) { |
| 58 if (vec.empty()) | 55 if (vec.empty()) |
| 59 return 0; | 56 return 0; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 169 |
| 173 int ChromeConfigurator::OnDemandDelay() { | 170 int ChromeConfigurator::OnDemandDelay() { |
| 174 return fast_update_ ? 2 : (30 * kDelayOneMinute); | 171 return fast_update_ ? 2 : (30 * kDelayOneMinute); |
| 175 } | 172 } |
| 176 | 173 |
| 177 GURL ChromeConfigurator::UpdateUrl() { | 174 GURL ChromeConfigurator::UpdateUrl() { |
| 178 return GURL(url_source_); | 175 return GURL(url_source_); |
| 179 } | 176 } |
| 180 | 177 |
| 181 GURL ChromeConfigurator::PingUrl() { | 178 GURL ChromeConfigurator::PingUrl() { |
| 182 return pings_enabled_ ? GURL(kPingUrl) : GURL(); | 179 return pings_enabled_ ? UpdateUrl() : GURL(); |
| 183 } | 180 } |
| 184 | 181 |
| 185 const char* ChromeConfigurator::ExtraRequestParams() { | 182 const char* ChromeConfigurator::ExtraRequestParams() { |
| 186 return extra_info_.c_str(); | 183 return extra_info_.c_str(); |
| 187 } | 184 } |
| 188 | 185 |
| 189 size_t ChromeConfigurator::UrlSizeLimit() { | 186 size_t ChromeConfigurator::UrlSizeLimit() { |
| 190 return 1024ul; | 187 return 1024ul; |
| 191 } | 188 } |
| 192 | 189 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 207 } | 204 } |
| 208 | 205 |
| 209 bool ChromeConfigurator::DeltasEnabled() const { | 206 bool ChromeConfigurator::DeltasEnabled() const { |
| 210 return deltas_enabled_; | 207 return deltas_enabled_; |
| 211 } | 208 } |
| 212 | 209 |
| 213 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator( | 210 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator( |
| 214 const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) { | 211 const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) { |
| 215 return new ChromeConfigurator(cmdline, context_getter); | 212 return new ChromeConfigurator(cmdline, context_getter); |
| 216 } | 213 } |
| OLD | NEW |