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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/message_loop/message_loop_proxy.h" | |
12 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
13 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "base/version.h" | 15 #include "base/version.h" |
16 // TODO(ddorwin): Find a better place for ReadManifest. | 16 // TODO(ddorwin): Find a better place for ReadManifest. |
17 #include "components/component_updater/component_updater_service.h" | 17 #include "components/component_updater/component_updater_service.h" |
18 #include "components/component_updater/default_component_installer.h" | 18 #include "components/component_updater/default_component_installer.h" |
19 #include "components/update_client/component_unpacker.h" | 19 #include "components/update_client/component_unpacker.h" |
20 #include "components/update_client/utils.h" | 20 #include "components/update_client/utils.h" |
21 | 21 |
22 using update_client::CrxComponent; | 22 using update_client::CrxComponent; |
23 | 23 |
24 namespace component_updater { | 24 namespace component_updater { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Version "0" corresponds to no installed version. By the server's conventions, | 28 // Version "0" corresponds to no installed version. By the server's conventions, |
29 // we represent it as a dotted quad. | 29 // we represent it as a dotted quad. |
30 const char kNullVersion[] = "0.0.0.0"; | 30 const char kNullVersion[] = "0.0.0.0"; |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 ComponentInstallerTraits::~ComponentInstallerTraits() { | 34 ComponentInstallerTraits::~ComponentInstallerTraits() { |
35 } | 35 } |
36 | 36 |
37 DefaultComponentInstaller::DefaultComponentInstaller( | 37 DefaultComponentInstaller::DefaultComponentInstaller( |
38 scoped_ptr<ComponentInstallerTraits> installer_traits) | 38 scoped_ptr<ComponentInstallerTraits> installer_traits) |
39 : current_version_(kNullVersion), | 39 : current_version_(kNullVersion), |
40 main_task_runner_(base::MessageLoopProxy::current()) { | 40 main_task_runner_(base::ThreadTaskRunnerHandle::Get()) { |
41 installer_traits_ = installer_traits.Pass(); | 41 installer_traits_ = installer_traits.Pass(); |
42 } | 42 } |
43 | 43 |
44 DefaultComponentInstaller::~DefaultComponentInstaller() { | 44 DefaultComponentInstaller::~DefaultComponentInstaller() { |
45 } | 45 } |
46 | 46 |
47 void DefaultComponentInstaller::Register( | 47 void DefaultComponentInstaller::Register( |
48 ComponentUpdateService* cus, | 48 ComponentUpdateService* cus, |
49 const base::Closure& callback) { | 49 const base::Closure& callback) { |
50 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 ComponentReady(manifest_copy.Pass()); | 265 ComponentReady(manifest_copy.Pass()); |
266 } | 266 } |
267 | 267 |
268 void DefaultComponentInstaller::ComponentReady( | 268 void DefaultComponentInstaller::ComponentReady( |
269 scoped_ptr<base::DictionaryValue> manifest) { | 269 scoped_ptr<base::DictionaryValue> manifest) { |
270 installer_traits_->ComponentReady( | 270 installer_traits_->ComponentReady( |
271 current_version_, GetInstallDirectory(), manifest.Pass()); | 271 current_version_, GetInstallDirectory(), manifest.Pass()); |
272 } | 272 } |
273 | 273 |
274 } // namespace component_updater | 274 } // namespace component_updater |
OLD | NEW |