| Index: components/update_client/task_update.cc
|
| diff --git a/components/update_client/task_update.cc b/components/update_client/task_update.cc
|
| index d253466e7e1110d6ca3b266dca50f308dd0118d0..c6a72e6ee2f15444ede4eff5a2eaa30ff8694b0f 100644
|
| --- a/components/update_client/task_update.cc
|
| +++ b/components/update_client/task_update.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/location.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/thread_task_runner_handle.h"
|
| +#include "components/update_client/update_client.h"
|
| #include "components/update_client/update_engine.h"
|
|
|
| namespace update_client {
|
| @@ -32,23 +33,30 @@ void TaskUpdate::Run() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| if (ids_.empty()) {
|
| - RunComplete(-1);
|
| + TaskComplete(Error::ERROR_UPDATE_INVALID_ARGUMENT);
|
| return;
|
| }
|
|
|
| update_engine_->Update(
|
| is_foreground_, ids_, crx_data_callback_,
|
| - base::Bind(&TaskUpdate::RunComplete, base::Unretained(this)));
|
| + base::Bind(&TaskUpdate::TaskComplete, base::Unretained(this)));
|
| +}
|
| +
|
| +void TaskUpdate::Cancel() {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + TaskComplete(Error::ERROR_UPDATE_CANCELED);
|
| }
|
|
|
| std::vector<std::string> TaskUpdate::GetIds() const {
|
| return ids_;
|
| }
|
|
|
| -void TaskUpdate::RunComplete(int error) {
|
| +void TaskUpdate::TaskComplete(int error) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - callback_.Run(this, error);
|
| + base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| + FROM_HERE, base::Bind(callback_, this, error));
|
| }
|
|
|
| } // namespace update_client
|
|
|