| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/action_update.h" | 5 #include "components/update_client/action_update.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 AppendDownloadMetrics(crx_downloader_->download_metrics(), | 97 AppendDownloadMetrics(crx_downloader_->download_metrics(), |
| 98 &item->download_metrics); | 98 &item->download_metrics); |
| 99 | 99 |
| 100 crx_downloader_.reset(); | 100 crx_downloader_.reset(); |
| 101 | 101 |
| 102 if (download_result.error) { | 102 if (download_result.error) { |
| 103 OnDownloadError(item, download_result); | 103 OnDownloadError(item, download_result); |
| 104 } else { | 104 } else { |
| 105 OnDownloadSuccess(item, download_result); | 105 OnDownloadSuccess(item, download_result); |
| 106 update_context_->main_task_runner->PostDelayedTask( | 106 update_context_->main_task_runner->PostTask( |
| 107 FROM_HERE, | 107 FROM_HERE, |
| 108 base::Bind(&ActionUpdate::StartInstall, base::Unretained(this), item, | 108 base::Bind(&ActionUpdate::StartInstall, base::Unretained(this), item, |
| 109 download_result.response), | 109 download_result.response)); |
| 110 base::TimeDelta::FromMilliseconds( | |
| 111 update_context_->config->StepDelay())); | |
| 112 } | 110 } |
| 113 } | 111 } |
| 114 | 112 |
| 115 void ActionUpdate::StartInstall(CrxUpdateItem* item, | 113 void ActionUpdate::StartInstall(CrxUpdateItem* item, |
| 116 const base::FilePath& crx_path) { | 114 const base::FilePath& crx_path) { |
| 117 DCHECK(thread_checker_.CalledOnValidThread()); | 115 DCHECK(thread_checker_.CalledOnValidThread()); |
| 118 DCHECK(item->id == update_context_->queue.front()); | 116 DCHECK(item->id == update_context_->queue.front()); |
| 119 | 117 |
| 120 OnInstallStart(item); | 118 OnInstallStart(item); |
| 121 | 119 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 result.error, result.extended_error)); | 175 result.error, result.extended_error)); |
| 178 } | 176 } |
| 179 | 177 |
| 180 void ActionUpdate::InstallCompleteOnBlockingTaskRunner( | 178 void ActionUpdate::InstallCompleteOnBlockingTaskRunner( |
| 181 CrxUpdateItem* item, | 179 CrxUpdateItem* item, |
| 182 const base::FilePath& crx_path, | 180 const base::FilePath& crx_path, |
| 183 ErrorCategory error_category, | 181 ErrorCategory error_category, |
| 184 int error, | 182 int error, |
| 185 int extended_error) { | 183 int extended_error) { |
| 186 update_client::DeleteFileAndEmptyParentDirectory(crx_path); | 184 update_client::DeleteFileAndEmptyParentDirectory(crx_path); |
| 187 update_context_->main_task_runner->PostDelayedTask( | 185 update_context_->main_task_runner->PostTask( |
| 188 FROM_HERE, | 186 FROM_HERE, |
| 189 base::Bind(&ActionUpdate::InstallComplete, base::Unretained(this), | 187 base::Bind(&ActionUpdate::InstallComplete, base::Unretained(this), |
| 190 item->id, error_category, error, extended_error), | 188 item->id, error_category, error, extended_error)); |
| 191 base::TimeDelta::FromMilliseconds(update_context_->config->StepDelay())); | |
| 192 } | 189 } |
| 193 | 190 |
| 194 CrxInstaller::Result ActionUpdate::DoInstall( | 191 CrxInstaller::Result ActionUpdate::DoInstall( |
| 195 CrxUpdateItem* item, | 192 CrxUpdateItem* item, |
| 196 const base::FilePath& crx_path, | 193 const base::FilePath& crx_path, |
| 197 const base::FilePath& unpack_path) { | 194 const base::FilePath& unpack_path) { |
| 198 const auto& fingerprint = item->next_fp; | 195 const auto& fingerprint = item->next_fp; |
| 199 if (static_cast<int>(fingerprint.size()) != | 196 if (static_cast<int>(fingerprint.size()) != |
| 200 base::WriteFile( | 197 base::WriteFile( |
| 201 unpack_path.Append(FILE_PATH_LITERAL("manifest.fingerprint")), | 198 unpack_path.Append(FILE_PATH_LITERAL("manifest.fingerprint")), |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 413 |
| 417 item->error_category = static_cast<int>(error_category); | 414 item->error_category = static_cast<int>(error_category); |
| 418 item->error_code = error; | 415 item->error_code = error; |
| 419 item->extra_code1 = extended_error; | 416 item->extra_code1 = extended_error; |
| 420 ChangeItemState(item, CrxUpdateItem::State::kNoUpdate); | 417 ChangeItemState(item, CrxUpdateItem::State::kNoUpdate); |
| 421 | 418 |
| 422 UpdateCrxComplete(item); | 419 UpdateCrxComplete(item); |
| 423 } | 420 } |
| 424 | 421 |
| 425 } // namespace update_client | 422 } // namespace update_client |
| OLD | NEW |