OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/prefs/pref_registry_simple.h" | 20 #include "base/prefs/pref_registry_simple.h" |
21 #include "base/prefs/pref_service.h" | 21 #include "base/prefs/pref_service.h" |
22 #include "base/process/kill.h" | 22 #include "base/process/kill.h" |
23 #include "base/process/launch.h" | 23 #include "base/process/launch.h" |
24 #include "base/task_runner_util.h" | 24 #include "base/task_runner_util.h" |
| 25 #include "base/threading/sequenced_worker_pool.h" |
25 #include "base/threading/worker_pool.h" | 26 #include "base/threading/worker_pool.h" |
26 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
27 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
28 #include "chrome/browser/component_updater/component_updater_service.h" | 29 #include "chrome/browser/component_updater/component_updater_service.h" |
29 #include "chrome/browser/component_updater/component_updater_utils.h" | 30 #include "chrome/browser/component_updater/component_updater_utils.h" |
30 #include "chrome/browser/component_updater/default_component_installer.h" | 31 #include "chrome/browser/component_updater/default_component_installer.h" |
31 #include "components/component_updater/component_updater_paths.h" | 32 #include "components/component_updater/component_updater_paths.h" |
32 #include "components/component_updater/pref_names.h" | 33 #include "components/component_updater/pref_names.h" |
33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
34 | 35 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 static wchar_t version_dir_[_MAX_PATH]; | 186 static wchar_t version_dir_[_MAX_PATH]; |
186 }; | 187 }; |
187 | 188 |
188 wchar_t SwReporterInstallerTraits::version_dir_[] = {}; | 189 wchar_t SwReporterInstallerTraits::version_dir_[] = {}; |
189 | 190 |
190 void RegisterComponent(ComponentUpdateService* cus, PrefService* prefs) { | 191 void RegisterComponent(ComponentUpdateService* cus, PrefService* prefs) { |
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
192 scoped_ptr<ComponentInstallerTraits> traits( | 193 scoped_ptr<ComponentInstallerTraits> traits( |
193 new SwReporterInstallerTraits(prefs)); | 194 new SwReporterInstallerTraits(prefs)); |
194 // |cus| will take ownership of |installer| during installer->Register(cus). | 195 // |cus| will take ownership of |installer| during installer->Register(cus). |
195 DefaultComponentInstaller* installer = | 196 DefaultComponentInstaller* installer = new DefaultComponentInstaller( |
196 new DefaultComponentInstaller(traits.Pass()); | 197 traits.Pass(), |
| 198 content::BrowserThread::GetBlockingPool() |
| 199 ->GetSequencedTaskRunnerWithShutdownBehavior( |
| 200 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), |
| 201 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
197 installer->Register(cus); | 202 installer->Register(cus); |
198 } | 203 } |
199 | 204 |
200 // We need a conditional version of register component so that it can be called | 205 // We need a conditional version of register component so that it can be called |
201 // back on the UI thread after validating on the File thread that the component | 206 // back on the UI thread after validating on the File thread that the component |
202 // path exists and we must re-register on startup for example. | 207 // path exists and we must re-register on startup for example. |
203 void MaybeRegisterComponent(ComponentUpdateService* cus, | 208 void MaybeRegisterComponent(ComponentUpdateService* cus, |
204 PrefService* prefs, | 209 PrefService* prefs, |
205 bool register_component) { | 210 bool register_component) { |
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 else | 277 else |
273 ReportUmaStep(SW_REPORTER_RETRIED_TOO_MANY_TIMES); | 278 ReportUmaStep(SW_REPORTER_RETRIED_TOO_MANY_TIMES); |
274 } | 279 } |
275 } | 280 } |
276 | 281 |
277 void RegisterPrefsForSwReporter(PrefRegistrySimple* registry) { | 282 void RegisterPrefsForSwReporter(PrefRegistrySimple* registry) { |
278 registry->RegisterIntegerPref(prefs::kSwReporterExecuteTryCount, 0); | 283 registry->RegisterIntegerPref(prefs::kSwReporterExecuteTryCount, 0); |
279 } | 284 } |
280 | 285 |
281 } // namespace component_updater | 286 } // namespace component_updater |
OLD | NEW |