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 "components/component_updater/default_component_installer.h" | 5 #include "components/component_updater/default_component_installer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 registration_info->manifest = std::move(manifest); | 221 registration_info->manifest = std::move(manifest); |
222 | 222 |
223 return true; | 223 return true; |
224 } | 224 } |
225 | 225 |
226 void DefaultComponentInstaller::StartRegistration( | 226 void DefaultComponentInstaller::StartRegistration( |
227 const scoped_refptr<RegistrationInfo>& registration_info, | 227 const scoped_refptr<RegistrationInfo>& registration_info, |
228 ComponentUpdateService* cus) { | 228 ComponentUpdateService* cus) { |
229 VLOG(1) << __func__ << " for " << installer_traits_->GetName(); | 229 VLOG(1) << __func__ << " for " << installer_traits_->GetName(); |
230 DCHECK(task_runner_.get()); | 230 DCHECK(task_runner_.get()); |
231 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 231 DCHECK(task_runner_->RunsTasksInCurrentSequence()); |
232 | 232 |
233 base::Version latest_version(kNullVersion); | 233 base::Version latest_version(kNullVersion); |
234 | 234 |
235 // First check for an installation set up alongside Chrome itself. | 235 // First check for an installation set up alongside Chrome itself. |
236 base::FilePath root; | 236 base::FilePath root; |
237 if (PathService::Get(DIR_COMPONENT_PREINSTALLED, &root) && | 237 if (PathService::Get(DIR_COMPONENT_PREINSTALLED, &root) && |
238 FindPreinstallation(root, registration_info)) { | 238 FindPreinstallation(root, registration_info)) { |
239 latest_version = registration_info->version; | 239 latest_version = registration_info->version; |
240 } | 240 } |
241 | 241 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 318 } |
319 | 319 |
320 // Remove older versions of the component. None should be in use during | 320 // Remove older versions of the component. None should be in use during |
321 // browser startup. | 321 // browser startup. |
322 for (const auto& older_path : older_paths) | 322 for (const auto& older_path : older_paths) |
323 base::DeleteFile(older_path, true); | 323 base::DeleteFile(older_path, true); |
324 } | 324 } |
325 | 325 |
326 void DefaultComponentInstaller::UninstallOnTaskRunner() { | 326 void DefaultComponentInstaller::UninstallOnTaskRunner() { |
327 DCHECK(task_runner_.get()); | 327 DCHECK(task_runner_.get()); |
328 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 328 DCHECK(task_runner_->RunsTasksInCurrentSequence()); |
329 | 329 |
330 // Only try to delete any files that are in our user-level install path. | 330 // Only try to delete any files that are in our user-level install path. |
331 base::FilePath userInstallPath; | 331 base::FilePath userInstallPath; |
332 if (!PathService::Get(DIR_COMPONENT_USER, &userInstallPath)) | 332 if (!PathService::Get(DIR_COMPONENT_USER, &userInstallPath)) |
333 return; | 333 return; |
334 if (!userInstallPath.IsParent(current_install_dir_)) | 334 if (!userInstallPath.IsParent(current_install_dir_)) |
335 return; | 335 return; |
336 | 336 |
337 const base::FilePath base_dir = current_install_dir_.DirName(); | 337 const base::FilePath base_dir = current_install_dir_.DirName(); |
338 base::FileEnumerator file_enumerator(base_dir, false, | 338 base::FileEnumerator file_enumerator(base_dir, false, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 void DefaultComponentInstaller::ComponentReady( | 401 void DefaultComponentInstaller::ComponentReady( |
402 std::unique_ptr<base::DictionaryValue> manifest) { | 402 std::unique_ptr<base::DictionaryValue> manifest) { |
403 VLOG(1) << "Component ready, version " << current_version_.GetString() | 403 VLOG(1) << "Component ready, version " << current_version_.GetString() |
404 << " in " << current_install_dir_.value(); | 404 << " in " << current_install_dir_.value(); |
405 installer_traits_->ComponentReady(current_version_, current_install_dir_, | 405 installer_traits_->ComponentReady(current_version_, current_install_dir_, |
406 std::move(manifest)); | 406 std::move(manifest)); |
407 } | 407 } |
408 | 408 |
409 } // namespace component_updater | 409 } // namespace component_updater |
OLD | NEW |