blob: 4a7fe185915b2757860ff77b4a1cb8b9fb3c6129 [file] [log] [blame]
Alex Deymob7ca0962014-10-01 17:58:07 -07001// Copyright 2015 The Chromium OS 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
5#ifndef UPDATE_ENGINE_DAEMON_H_
6#define UPDATE_ENGINE_DAEMON_H_
7
8#include <memory>
9#include <string>
10
11#include <chromeos/daemons/dbus_daemon.h>
12
13#include "update_engine/certificate_checker.h"
14#include "update_engine/dbus_service.h"
15#include "update_engine/real_system_state.h"
16#include "update_engine/subprocess.h"
17
18namespace chromeos_update_engine {
19
20class UpdateEngineDaemon : public chromeos::DBusDaemon {
21 public:
22 UpdateEngineDaemon() = default;
23
24 protected:
25 int OnInit() override;
26
27 private:
28 // Run from the main loop when the |dbus_adaptor_| object is registered. At
29 // this point we can request ownership of the DBus service name and continue
30 // initialization.
31 void OnDBusRegistered(bool succeeded);
32
33 // The Subprocess singleton class requires a chromeos::MessageLoop in the
34 // current thread, so we need to initialize it from this class instead of
35 // the main() function.
36 Subprocess subprocess_;
37
38 std::unique_ptr<RealSystemState> real_system_state_;
39 OpenSSLWrapper openssl_wrapper_;
40 std::unique_ptr<UpdateEngineAdaptor> dbus_adaptor_;
41
42 DISALLOW_COPY_AND_ASSIGN(UpdateEngineDaemon);
43};
44
45} // namespace chromeos_update_engine
46
47#endif // UPDATE_ENGINE_DAEMON_H_