blob: 1c7301bc4348381b46cb54534940789d99828af1 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
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 Deymo30534502015-07-20 15:06:33 -070016
17#include "update_engine/shill_proxy.h"
18
19#include <chromeos/dbus/service_constants.h>
20
21#include "update_engine/dbus_proxies.h"
22
23using org::chromium::flimflam::ManagerProxy;
24using org::chromium::flimflam::ManagerProxyInterface;
25using org::chromium::flimflam::ServiceProxy;
26using org::chromium::flimflam::ServiceProxyInterface;
27
28namespace chromeos_update_engine {
29
30ShillProxy::ShillProxy(const scoped_refptr<dbus::Bus>& bus) : bus_(bus) {}
31
32bool ShillProxy::Init() {
33 manager_proxy_.reset(
34 new ManagerProxy(bus_,
35 shill::kFlimflamServiceName,
36 dbus::ObjectPath(shill::kFlimflamServicePath)));
37 return true;
38}
39
40ManagerProxyInterface* ShillProxy::GetManagerProxy() {
41 return manager_proxy_.get();
42}
43
44std::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