summaryrefslogtreecommitdiff
path: root/chromium/components/update_client/action_runner.h
blob: a2f3174e8b0bdeeb0a1a7837062aa14ef067f6d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_UPDATE_CLIENT_ACTION_RUNNER_H_
#define COMPONENTS_UPDATE_CLIENT_ACTION_RUNNER_H_

#include "base/callback.h"
#include "base/threading/thread_checker.h"
#include "components/update_client/update_client.h"

namespace base {
class FilePath;
class SingleThreadTaskRunner;
}  // namespace base

namespace update_client {

class Component;

class ActionRunner {
 public:
  using Callback = ActionHandler::Callback;

  explicit ActionRunner(const Component& component);
  ~ActionRunner();

  void Run(Callback run_complete);

 private:
  void Handle(const base::FilePath& crx_path);

  THREAD_CHECKER(thread_checker_);

  const Component& component_;

  // Used to post callbacks to the main thread.
  scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;

  Callback callback_;

  ActionRunner(const ActionRunner&) = delete;
  ActionRunner& operator=(const ActionRunner&) = delete;
};

}  // namespace update_client

#endif  // COMPONENTS_UPDATE_CLIENT_ACTION_RUNNER_H_