summaryrefslogtreecommitdiffstats
path: root/chromium/components/update_client/action_runner.h
blob: 9b012c79ea4248b6c1c290afd4fa53d2294e8c5d (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
// 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/functional/callback.h"
#include "base/memory/raw_ref.h"
#include "base/sequence_checker.h"
#include "components/update_client/update_client.h"

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

namespace update_client {

class Component;

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

  explicit ActionRunner(const Component& component);
  ~ActionRunner();
  ActionRunner(const ActionRunner&) = delete;
  ActionRunner& operator=(const ActionRunner&) = delete;

  void Run(Callback run_complete);

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

  SEQUENCE_CHECKER(sequence_checker_);

  const raw_ref<const Component> component_;

  // Used to post callbacks to the main sequence.
  scoped_refptr<base::SequencedTaskRunner> main_task_runner_;

  Callback callback_;
};

}  // namespace update_client

#endif  // COMPONENTS_UPDATE_CLIENT_ACTION_RUNNER_H_