| Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2015 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 | // | 
| Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 16 |  | 
|  | 17 | #ifndef UPDATE_ENGINE_DAEMON_H_ | 
|  | 18 | #define UPDATE_ENGINE_DAEMON_H_ | 
|  | 19 |  | 
|  | 20 | #include <memory> | 
|  | 21 | #include <string> | 
|  | 22 |  | 
|  | 23 | #include <chromeos/daemons/dbus_daemon.h> | 
|  | 24 |  | 
|  | 25 | #include "update_engine/certificate_checker.h" | 
|  | 26 | #include "update_engine/dbus_service.h" | 
|  | 27 | #include "update_engine/real_system_state.h" | 
|  | 28 | #include "update_engine/subprocess.h" | 
|  | 29 |  | 
|  | 30 | namespace chromeos_update_engine { | 
|  | 31 |  | 
|  | 32 | class UpdateEngineDaemon : public chromeos::DBusDaemon { | 
|  | 33 | public: | 
|  | 34 | UpdateEngineDaemon() = default; | 
|  | 35 |  | 
|  | 36 | protected: | 
|  | 37 | int OnInit() override; | 
|  | 38 |  | 
|  | 39 | private: | 
|  | 40 | // Run from the main loop when the |dbus_adaptor_| object is registered. At | 
|  | 41 | // this point we can request ownership of the DBus service name and continue | 
|  | 42 | // initialization. | 
|  | 43 | void OnDBusRegistered(bool succeeded); | 
|  | 44 |  | 
|  | 45 | // The Subprocess singleton class requires a chromeos::MessageLoop in the | 
|  | 46 | // current thread, so we need to initialize it from this class instead of | 
|  | 47 | // the main() function. | 
|  | 48 | Subprocess subprocess_; | 
|  | 49 |  | 
|  | 50 | std::unique_ptr<RealSystemState> real_system_state_; | 
|  | 51 | OpenSSLWrapper openssl_wrapper_; | 
|  | 52 | std::unique_ptr<UpdateEngineAdaptor> dbus_adaptor_; | 
|  | 53 |  | 
|  | 54 | DISALLOW_COPY_AND_ASSIGN(UpdateEngineDaemon); | 
|  | 55 | }; | 
|  | 56 |  | 
|  | 57 | }  // namespace chromeos_update_engine | 
|  | 58 |  | 
|  | 59 | #endif  // UPDATE_ENGINE_DAEMON_H_ |