1// 2// Copyright (C) 2014 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17#ifndef APMANAGER_DAEMON_H_ 18#define APMANAGER_DAEMON_H_ 19 20#include <base/callback_forward.h> 21#include <brillo/daemons/daemon.h> 22 23#include "apmanager/control_interface.h" 24 25namespace apmanager { 26 27class Daemon : public brillo::Daemon { 28 public: 29 // User and group to run the apmanager process. 30 static const char kAPManagerGroupName[]; 31 static const char kAPManagerUserName[]; 32 33 explicit Daemon(const base::Closure& startup_callback); 34 ~Daemon() = default; 35 36 protected: 37 int OnInit() override; 38 void OnShutdown(int* return_code) override; 39 40 private: 41 friend class DaemonTest; 42 43 std::unique_ptr<ControlInterface> control_interface_; 44 base::Closure startup_callback_; 45 46 DISALLOW_COPY_AND_ASSIGN(Daemon); 47}; 48 49} // namespace apmanager 50 51#endif // APMANAGER_DAEMON_H_ 52