blob: caa68b3fa1b1d78de495b8843d24b6767b93f17f [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
Alex Deymo30534502015-07-20 15:06:33 -070021
22using org::chromium::flimflam::ManagerProxy;
23using org::chromium::flimflam::ManagerProxyInterface;
24using org::chromium::flimflam::ServiceProxy;
25using org::chromium::flimflam::ServiceProxyInterface;
26
27namespace chromeos_update_engine {
28
29ShillProxy::ShillProxy(const scoped_refptr<dbus::Bus>& bus) : bus_(bus) {}
30
31bool ShillProxy::Init() {
32 manager_proxy_.reset(
33 new ManagerProxy(bus_,
34 shill::kFlimflamServiceName,
35 dbus::ObjectPath(shill::kFlimflamServicePath)));
36 return true;
37}
38
39ManagerProxyInterface* ShillProxy::GetManagerProxy() {
40 return manager_proxy_.get();
41}
42
43std::unique_ptr<ServiceProxyInterface> ShillProxy::GetServiceForPath(
44 const std::string& path) {
45 DCHECK(bus_.get());
46 return std::unique_ptr<ServiceProxyInterface>(new ServiceProxy(
47 bus_, shill::kFlimflamServiceName, dbus::ObjectPath(path)));
48}
49
50} // namespace chromeos_update_engine