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 | #include "update_engine/shill_proxy.h" |
| 6 | |
| 7 | #include <chromeos/dbus/service_constants.h> |
| 8 | |
| 9 | #include "update_engine/dbus_proxies.h" |
| 10 | |
| 11 | using org::chromium::flimflam::ManagerProxy; |
| 12 | using org::chromium::flimflam::ManagerProxyInterface; |
| 13 | using org::chromium::flimflam::ServiceProxy; |
| 14 | using org::chromium::flimflam::ServiceProxyInterface; |
| 15 | |
| 16 | namespace chromeos_update_engine { |
| 17 | |
| 18 | ShillProxy::ShillProxy(const scoped_refptr<dbus::Bus>& bus) : bus_(bus) {} |
| 19 | |
| 20 | bool ShillProxy::Init() { |
| 21 | manager_proxy_.reset( |
| 22 | new ManagerProxy(bus_, |
| 23 | shill::kFlimflamServiceName, |
| 24 | dbus::ObjectPath(shill::kFlimflamServicePath))); |
| 25 | return true; |
| 26 | } |
| 27 | |
| 28 | ManagerProxyInterface* ShillProxy::GetManagerProxy() { |
| 29 | return manager_proxy_.get(); |
| 30 | } |
| 31 | |
| 32 | std::unique_ptr<ServiceProxyInterface> ShillProxy::GetServiceForPath( |
| 33 | const std::string& path) { |
| 34 | DCHECK(bus_.get()); |
| 35 | return std::unique_ptr<ServiceProxyInterface>(new ServiceProxy( |
| 36 | bus_, shill::kFlimflamServiceName, dbus::ObjectPath(path))); |
| 37 | } |
| 38 | |
| 39 | } // namespace chromeos_update_engine |