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" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.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_unpacker.h" | 17 #include "components/component_updater/component_updater_service.h" |
18 #include "components/component_updater/component_updater_configurator.h" | |
19 #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" |
| 20 #include "components/update_client/update_client.h" |
| 21 |
| 22 using update_client::CrxComponent; |
20 | 23 |
21 namespace component_updater { | 24 namespace component_updater { |
22 | 25 |
23 namespace { | 26 namespace { |
24 // Version "0" corresponds to no installed version. By the server's conventions, | 27 // Version "0" corresponds to no installed version. By the server's conventions, |
25 // we represent it as a dotted quad. | 28 // we represent it as a dotted quad. |
26 const char kNullVersion[] = "0.0.0.0"; | 29 const char kNullVersion[] = "0.0.0.0"; |
27 } // namespace | 30 } // namespace |
28 | 31 |
29 ComponentInstallerTraits::~ComponentInstallerTraits() { | 32 ComponentInstallerTraits::~ComponentInstallerTraits() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (!version.IsValid()) | 151 if (!version.IsValid()) |
149 continue; | 152 continue; |
150 | 153 |
151 // |version| not newer than the latest found version (kNullVersion if no | 154 // |version| not newer than the latest found version (kNullVersion if no |
152 // version has been found yet) is marked for removal. | 155 // version has been found yet) is marked for removal. |
153 if (version.CompareTo(latest_version) <= 0) { | 156 if (version.CompareTo(latest_version) <= 0) { |
154 older_paths.push_back(path); | 157 older_paths.push_back(path); |
155 continue; | 158 continue; |
156 } | 159 } |
157 | 160 |
158 scoped_ptr<base::DictionaryValue> manifest = ReadManifest(path); | 161 scoped_ptr<base::DictionaryValue> manifest = |
| 162 update_client::ReadManifest(path); |
159 if (!manifest || !installer_traits_->VerifyInstallation(*manifest, path)) { | 163 if (!manifest || !installer_traits_->VerifyInstallation(*manifest, path)) { |
160 DLOG(ERROR) << "Failed to read manifest or verify installation for " | 164 DLOG(ERROR) << "Failed to read manifest or verify installation for " |
161 << installer_traits_->GetName() << " (" | 165 << installer_traits_->GetName() << " (" |
162 << path.MaybeAsASCII() << ")."; | 166 << path.MaybeAsASCII() << ")."; |
163 older_paths.push_back(path); | 167 older_paths.push_back(path); |
164 continue; | 168 continue; |
165 } | 169 } |
166 | 170 |
167 // New valid |version| folder found! | 171 // New valid |version| folder found! |
168 | 172 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (!current_manifest_) | 228 if (!current_manifest_) |
225 return; | 229 return; |
226 | 230 |
227 scoped_ptr<base::DictionaryValue> manifest_copy( | 231 scoped_ptr<base::DictionaryValue> manifest_copy( |
228 current_manifest_->DeepCopy()); | 232 current_manifest_->DeepCopy()); |
229 installer_traits_->ComponentReady( | 233 installer_traits_->ComponentReady( |
230 current_version_, GetInstallDirectory(), manifest_copy.Pass()); | 234 current_version_, GetInstallDirectory(), manifest_copy.Pass()); |
231 } | 235 } |
232 | 236 |
233 } // namespace component_updater | 237 } // namespace component_updater |
OLD | NEW |