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_LIBCROS_PROXY_H_ |
| 6 | #define UPDATE_ENGINE_LIBCROS_PROXY_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | |
| 10 | #include <base/macros.h> |
| 11 | #include <dbus/bus.h> |
| 12 | |
| 13 | #include "update_engine/dbus_proxies.h" |
| 14 | |
| 15 | namespace chromeos_update_engine { |
| 16 | |
| 17 | // This class handles the DBus connection with chrome to resolve proxies. This |
| 18 | // is a thin class to just hold the generated proxies (real or mocked ones). |
| 19 | class LibCrosProxy final { |
| 20 | public: |
| 21 | explicit LibCrosProxy(const scoped_refptr<dbus::Bus>& bus); |
| 22 | LibCrosProxy( |
| 23 | std::unique_ptr<org::chromium::LibCrosServiceInterfaceProxyInterface> |
| 24 | service_interface_proxy, |
| 25 | std::unique_ptr< |
| 26 | org::chromium:: |
| 27 | UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface> |
| 28 | ue_proxy_resolved_interface); |
| 29 | |
| 30 | ~LibCrosProxy() = default; |
| 31 | |
| 32 | // Getters for the two proxies. |
| 33 | org::chromium::LibCrosServiceInterfaceProxyInterface* |
| 34 | service_interface_proxy(); |
| 35 | org::chromium::UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface* |
| 36 | ue_proxy_resolved_interface(); |
| 37 | |
| 38 | private: |
| 39 | std::unique_ptr<org::chromium::LibCrosServiceInterfaceProxyInterface> |
| 40 | service_interface_proxy_; |
| 41 | std::unique_ptr< |
| 42 | org::chromium::UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface> |
| 43 | ue_proxy_resolved_interface_; |
| 44 | |
| 45 | DISALLOW_COPY_AND_ASSIGN(LibCrosProxy); |
| 46 | }; |
| 47 | |
| 48 | } // namespace chromeos_update_engine |
| 49 | |
| 50 | #endif // UPDATE_ENGINE_LIBCROS_PROXY_H_ |