blob: cd6af1cab8eac7721daf7ad9d6da7d16fc57a89b [file] [log] [blame]
Peter Qiu5dd242d2014-10-14 12:23:21 -07001// Copyright 2014 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 APMANAGER_DAEMON_H_
6#define APMANAGER_DAEMON_H_
7
Alex Vakulenkob56e3cd2015-04-24 18:09:32 -07008#include <base/callback_forward.h>
Peter Qiu5dd242d2014-10-14 12:23:21 -07009#include <chromeos/daemons/dbus_daemon.h>
10
11#include "apmanager/manager.h"
12
13namespace apmanager {
14
15class Daemon : public chromeos::DBusServiceDaemon {
16 public:
17 // User and group to run the apmanager process.
18 static const char kAPManagerGroupName[];
19 static const char kAPManagerUserName[];
20
21 explicit Daemon(const base::Closure& startup_callback);
22 ~Daemon() = default;
23
24 protected:
25 int OnInit() override;
26 void OnShutdown(int* return_code) override;
Peter Qiu376e4042014-11-13 09:40:28 -080027 void RegisterDBusObjectsAsync(
28 chromeos::dbus_utils::AsyncEventSequencer* sequencer) override;
Peter Qiu5dd242d2014-10-14 12:23:21 -070029
30 private:
31 friend class DaemonTest;
32
33 std::unique_ptr<Manager> manager_;
34 base::Closure startup_callback_;
35
36 DISALLOW_COPY_AND_ASSIGN(Daemon);
37};
38
39} // namespace apmanager
40
41#endif // APMANAGER_DAEMON_H_