| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/update_client/component.h" | 5 #include "components/update_client/component.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 void InstallOnBlockingTaskRunner( | 89 void InstallOnBlockingTaskRunner( |
| 90 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, | 90 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
| 91 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 91 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
| 92 const base::FilePath& unpack_path, | 92 const base::FilePath& unpack_path, |
| 93 const std::string& fingerprint, | 93 const std::string& fingerprint, |
| 94 const scoped_refptr<CrxInstaller>& installer, | 94 const scoped_refptr<CrxInstaller>& installer, |
| 95 InstallOnBlockingTaskRunnerCompleteCallback callback) { | 95 InstallOnBlockingTaskRunnerCompleteCallback callback) { |
| 96 DCHECK(blocking_task_runner->RunsTasksOnCurrentThread()); | 96 DCHECK(blocking_task_runner->RunsTasksOnCurrentThread()); |
| 97 | 97 |
| 98 DCHECK(base::DirectoryExists(unpack_path)); |
| 98 const auto result = DoInstallOnBlockingTaskRunner( | 99 const auto result = DoInstallOnBlockingTaskRunner( |
| 99 main_task_runner, blocking_task_runner, unpack_path, fingerprint, | 100 main_task_runner, blocking_task_runner, unpack_path, fingerprint, |
| 100 installer, callback); | 101 installer, callback); |
| 102 base::DeleteFile(unpack_path, true); |
| 101 | 103 |
| 102 const ErrorCategory error_category = | 104 const ErrorCategory error_category = |
| 103 result.error ? ErrorCategory::kInstallError : ErrorCategory::kErrorNone; | 105 result.error ? ErrorCategory::kInstallError : ErrorCategory::kErrorNone; |
| 104 main_task_runner->PostTask( | 106 main_task_runner->PostTask( |
| 105 FROM_HERE, | 107 FROM_HERE, |
| 106 base::Bind(callback, static_cast<int>(error_category), | 108 base::Bind(callback, static_cast<int>(error_category), |
| 107 static_cast<int>(result.error), result.extended_error)); | 109 static_cast<int>(result.error), result.extended_error)); |
| 108 } | 110 } |
| 109 | 111 |
| 110 void UnpackCompleteOnBlockingTaskRunner( | 112 void UnpackCompleteOnBlockingTaskRunner( |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 void Component::StateUninstalled::DoHandle() { | 707 void Component::StateUninstalled::DoHandle() { |
| 706 DCHECK(thread_checker_.CalledOnValidThread()); | 708 DCHECK(thread_checker_.CalledOnValidThread()); |
| 707 | 709 |
| 708 auto& component = State::component(); | 710 auto& component = State::component(); |
| 709 component.AppendEvent(BuildUninstalledEventElement(component)); | 711 component.AppendEvent(BuildUninstalledEventElement(component)); |
| 710 | 712 |
| 711 TransitionState(nullptr); | 713 TransitionState(nullptr); |
| 712 } | 714 } |
| 713 | 715 |
| 714 } // namespace update_client | 716 } // namespace update_client |
| OLD | NEW |