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 | 3053450 | 2015-07-20 15:06:33 -0700 | [diff] [blame] | 16 | |
| 17 | #include "update_engine/shill_proxy.h" |
| 18 | |
| 19 | #include <chromeos/dbus/service_constants.h> |
| 20 | |
| 21 | #include "update_engine/dbus_proxies.h" |
| 22 | |
| 23 | using org::chromium::flimflam::ManagerProxy; |
| 24 | using org::chromium::flimflam::ManagerProxyInterface; |
| 25 | using org::chromium::flimflam::ServiceProxy; |
| 26 | using org::chromium::flimflam::ServiceProxyInterface; |
| 27 | |
| 28 | namespace chromeos_update_engine { |
| 29 | |
| 30 | ShillProxy::ShillProxy(const scoped_refptr<dbus::Bus>& bus) : bus_(bus) {} |
| 31 | |
| 32 | bool ShillProxy::Init() { |
| 33 | manager_proxy_.reset( |
| 34 | new ManagerProxy(bus_, |
| 35 | shill::kFlimflamServiceName, |
| 36 | dbus::ObjectPath(shill::kFlimflamServicePath))); |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | ManagerProxyInterface* ShillProxy::GetManagerProxy() { |
| 41 | return manager_proxy_.get(); |
| 42 | } |
| 43 | |
| 44 | std::unique_ptr<ServiceProxyInterface> ShillProxy::GetServiceForPath( |
| 45 | const std::string& path) { |
| 46 | DCHECK(bus_.get()); |
| 47 | return std::unique_ptr<ServiceProxyInterface>(new ServiceProxy( |
| 48 | bus_, shill::kFlimflamServiceName, dbus::ObjectPath(path))); |
| 49 | } |
| 50 | |
| 51 | } // namespace chromeos_update_engine |