Alex Deymo | 3053450 | 2015-07-20 15:06:33 -0700 | [diff] [blame] | 1 | // 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_SHILL_PROXY_H_ |
| 6 | #define UPDATE_ENGINE_SHILL_PROXY_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/macros.h> |
| 12 | #include <dbus/bus.h> |
| 13 | |
| 14 | #include "update_engine/dbus_proxies.h" |
| 15 | #include "update_engine/shill_proxy_interface.h" |
| 16 | |
| 17 | namespace chromeos_update_engine { |
| 18 | |
| 19 | // This class implements the connection to shill using real DBus calls. |
| 20 | class ShillProxy : public ShillProxyInterface { |
| 21 | public: |
| 22 | explicit ShillProxy(const scoped_refptr<dbus::Bus>& bus); |
| 23 | ~ShillProxy() override = default; |
| 24 | |
| 25 | // Initializes the ShillProxy instance creating the manager proxy from the |
| 26 | // |bus_|. |
| 27 | bool Init(); |
| 28 | |
| 29 | // ShillProxyInterface overrides. |
| 30 | org::chromium::flimflam::ManagerProxyInterface* GetManagerProxy() override; |
| 31 | std::unique_ptr<org::chromium::flimflam::ServiceProxyInterface> |
| 32 | GetServiceForPath(const std::string& path) override; |
| 33 | |
| 34 | private: |
| 35 | // A reference to the main bus for creating new ServiceProxy instances. |
| 36 | scoped_refptr<dbus::Bus> bus_; |
| 37 | std::unique_ptr<org::chromium::flimflam::ManagerProxyInterface> |
| 38 | manager_proxy_; |
| 39 | |
| 40 | DISALLOW_COPY_AND_ASSIGN(ShillProxy); |
| 41 | }; |
| 42 | |
| 43 | } // namespace chromeos_update_engine |
| 44 | |
| 45 | #endif // UPDATE_ENGINE_SHILL_PROXY_H_ |