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/component_updater/chrome_component_updater_configurator
.h" | 5 #include "chrome/browser/component_updater/chrome_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_split.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/version.h" | 15 #include "base/version.h" |
15 #if defined(OS_WIN) | |
16 #include "base/win/win_util.h" | |
17 #endif // OS_WIN | |
18 #include "build/build_config.h" | 16 #include "build/build_config.h" |
19 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" | 17 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" |
20 #include "chrome/browser/component_updater/component_updater_url_constants.h" | 18 #include "chrome/browser/component_updater/component_updater_url_constants.h" |
21 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 19 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
22 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
23 #include "components/component_updater/component_updater_switches.h" | 21 #include "components/component_updater/component_updater_switches.h" |
24 #include "components/update_client/configurator.h" | 22 #include "components/update_client/configurator.h" |
25 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
26 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
27 #include "url/gurl.h" | 25 #include "url/gurl.h" |
28 | 26 |
| 27 #if defined(OS_WIN) |
| 28 #include "base/win/win_util.h" |
| 29 #endif // OS_WIN |
| 30 |
29 using update_client::Configurator; | 31 using update_client::Configurator; |
30 using update_client::OutOfProcessPatcher; | 32 using update_client::OutOfProcessPatcher; |
31 | 33 |
32 namespace component_updater { | 34 namespace component_updater { |
33 | 35 |
34 namespace { | 36 namespace { |
35 | 37 |
36 // Default time constants. | 38 // Default time constants. |
37 const int kDelayOneMinute = 60; | 39 const int kDelayOneMinute = 60; |
38 const int kDelayOneHour = kDelayOneMinute * 60; | 40 const int kDelayOneHour = kDelayOneMinute * 60; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 ChromeConfigurator::ChromeConfigurator( | 146 ChromeConfigurator::ChromeConfigurator( |
145 const base::CommandLine* cmdline, | 147 const base::CommandLine* cmdline, |
146 net::URLRequestContextGetter* url_request_getter) | 148 net::URLRequestContextGetter* url_request_getter) |
147 : url_request_getter_(url_request_getter), | 149 : url_request_getter_(url_request_getter), |
148 fast_update_(false), | 150 fast_update_(false), |
149 pings_enabled_(false), | 151 pings_enabled_(false), |
150 deltas_enabled_(false), | 152 deltas_enabled_(false), |
151 background_downloads_enabled_(false), | 153 background_downloads_enabled_(false), |
152 fallback_to_alt_source_url_enabled_(false) { | 154 fallback_to_alt_source_url_enabled_(false) { |
153 // Parse comma-delimited debug flags. | 155 // Parse comma-delimited debug flags. |
154 std::vector<std::string> switch_values; | 156 std::vector<std::string> switch_values = base::SplitString( |
155 Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdater), | 157 cmdline->GetSwitchValueASCII(switches::kComponentUpdater), |
156 ",", | 158 ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
157 &switch_values); | |
158 fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate); | 159 fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate); |
159 pings_enabled_ = !HasSwitchValue(switch_values, kSwitchDisablePings); | 160 pings_enabled_ = !HasSwitchValue(switch_values, kSwitchDisablePings); |
160 deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates); | 161 deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates); |
161 | 162 |
162 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
163 background_downloads_enabled_ = | 164 background_downloads_enabled_ = |
164 !HasSwitchValue(switch_values, kSwitchDisableBackgroundDownloads); | 165 !HasSwitchValue(switch_values, kSwitchDisableBackgroundDownloads); |
165 #else | 166 #else |
166 background_downloads_enabled_ = false; | 167 background_downloads_enabled_ = false; |
167 #endif | 168 #endif |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } // namespace | 271 } // namespace |
271 | 272 |
272 scoped_refptr<update_client::Configurator> | 273 scoped_refptr<update_client::Configurator> |
273 MakeChromeComponentUpdaterConfigurator( | 274 MakeChromeComponentUpdaterConfigurator( |
274 const base::CommandLine* cmdline, | 275 const base::CommandLine* cmdline, |
275 net::URLRequestContextGetter* context_getter) { | 276 net::URLRequestContextGetter* context_getter) { |
276 return new ChromeConfigurator(cmdline, context_getter); | 277 return new ChromeConfigurator(cmdline, context_getter); |
277 } | 278 } |
278 | 279 |
279 } // namespace component_updater | 280 } // namespace component_updater |
OLD | NEW |