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 17 matching lines...) Expand all Loading... |
28 const int kDelayOneMinute = 60; | 28 const int kDelayOneMinute = 60; |
29 const int kDelayOneHour = kDelayOneMinute * 60; | 29 const int kDelayOneHour = kDelayOneMinute * 60; |
30 | 30 |
31 // Debug values you can pass to --component-updater=value1,value2. | 31 // Debug values you can pass to --component-updater=value1,value2. |
32 // Speed up component checking. | 32 // Speed up component checking. |
33 const char kSwitchFastUpdate[] = "fast-update"; | 33 const char kSwitchFastUpdate[] = "fast-update"; |
34 // Force out-of-process-xml parsing. | 34 // Force out-of-process-xml parsing. |
35 const char kSwitchOutOfProcess[] = "out-of-process"; | 35 const char kSwitchOutOfProcess[] = "out-of-process"; |
36 // Add "testrequest=1" parameter to the update check query. | 36 // Add "testrequest=1" parameter to the update check query. |
37 const char kSwitchRequestParam[] = "test-request"; | 37 const char kSwitchRequestParam[] = "test-request"; |
38 // Disables differential updates. | |
39 const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates"; | |
40 // Disables pings. Pings are the requests sent to the update server that report | 38 // Disables pings. Pings are the requests sent to the update server that report |
41 // the success or the failure of component install or update attempts. | 39 // the success or the failure of component install or update attempts. |
42 extern const char kSwitchDisablePings[] = "disable-pings"; | 40 extern const char kSwitchDisablePings[] = "disable-pings"; |
43 | 41 |
44 // Sets the URL for updates. | 42 // Sets the URL for updates. |
45 const char kSwitchUrlSource[] = "url-source"; | 43 const char kSwitchUrlSource[] = "url-source"; |
46 | 44 |
47 // The default url from which an update manifest can be fetched. Can be | 45 // The default url from which an update manifest can be fetched. Can be |
48 // overridden with --component-updater=url-source=someurl. | 46 // overridden with --component-updater=url-source=someurl. |
49 const char kDefaultUrlSource[] = | 47 const char kDefaultUrlSource[] = |
50 "http://clients2.google.com/service/update2/crx"; | 48 "http://clients2.google.com/service/update2/crx"; |
51 | 49 |
52 // The url to send the pings to. | 50 // The url to send the pings to. |
53 const char kPingUrl[] = "http://tools.google.com/service/update2"; | 51 const char kPingUrl[] = "http://tools.google.com/service/update2"; |
54 | 52 |
| 53 #if defined(OS_WIN) |
| 54 // Disables differential updates. |
| 55 const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates"; |
| 56 #endif // defined(OS_WIN) |
| 57 |
55 // Returns true if and only if |test| is contained in |vec|. | 58 // Returns true if and only if |test| is contained in |vec|. |
56 bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) { | 59 bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) { |
57 if (vec.empty()) | 60 if (vec.empty()) |
58 return 0; | 61 return 0; |
59 return (std::find(vec.begin(), vec.end(), test) != vec.end()); | 62 return (std::find(vec.begin(), vec.end(), test) != vec.end()); |
60 } | 63 } |
61 | 64 |
62 // If there is an element of |vec| of the form |test|=.*, returns the right- | 65 // If there is an element of |vec| of the form |test|=.*, returns the right- |
63 // hand side of that assignment. Otherwise, returns an empty string. | 66 // hand side of that assignment. Otherwise, returns an empty string. |
64 // The right-hand side may contain additional '=' characters, allowing for | 67 // The right-hand side may contain additional '=' characters, allowing for |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 212 } |
210 | 213 |
211 bool ChromeConfigurator::DeltasEnabled() const { | 214 bool ChromeConfigurator::DeltasEnabled() const { |
212 return deltas_enabled_; | 215 return deltas_enabled_; |
213 } | 216 } |
214 | 217 |
215 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator( | 218 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator( |
216 const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) { | 219 const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) { |
217 return new ChromeConfigurator(cmdline, context_getter); | 220 return new ChromeConfigurator(cmdline, context_getter); |
218 } | 221 } |
OLD | NEW |