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
3 // found in the LICENSE file.
4 #include "components/update_client/task_update.h"
7 #include "base/bind_helpers.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "components/update_client/update_engine.h"
13 namespace update_client
{
15 TaskUpdate::TaskUpdate(UpdateEngine
* update_engine
,
17 const std::vector
<std::string
>& ids
,
18 const UpdateClient::CrxDataCallback
& crx_data_callback
,
19 const Callback
& callback
)
20 : update_engine_(update_engine
),
21 is_foreground_(is_foreground
),
23 crx_data_callback_(crx_data_callback
),
27 TaskUpdate::~TaskUpdate() {
28 DCHECK(thread_checker_
.CalledOnValidThread());
31 void TaskUpdate::Run() {
32 DCHECK(thread_checker_
.CalledOnValidThread());
37 update_engine_
->Update(
38 is_foreground_
, ids_
, crx_data_callback_
,
39 base::Bind(&TaskUpdate::RunComplete
, base::Unretained(this)));
42 void TaskUpdate::RunComplete(int error
) {
43 DCHECK(thread_checker_
.CalledOnValidThread());
45 callback_
.Run(this, error
);
48 } // namespace update_client