blob: 0311c949031135a5352f0f0fd62148dfb87bd0fe [file] [log] [blame]
Peter Qiu7e0ffcf2014-12-02 12:53:27 -08001// Copyright 2014 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 APMANAGER_SHILL_PROXY_H_
6#define APMANAGER_SHILL_PROXY_H_
7
8#include <set>
9#include <string>
10
11#include <base/macros.h>
12#include <base/memory/scoped_ptr.h>
13
14#include "shill/dbus-proxies.h"
15
16// Proxy for shill "org.chromium.flimflam" DBus service.
17namespace apmanager {
18
19class ShillProxy {
20 public:
21 ShillProxy();
22 virtual ~ShillProxy();
23
Peter Qiuc9ce1f12014-12-05 11:14:29 -080024 void Init(const scoped_refptr<dbus::Bus>& bus);
25
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080026 // Claim the given interface |interface_name| from shill.
27 virtual void ClaimInterface(const std::string& interface_name);
28 // Release the given interface |interface_name| to shill.
29 virtual void ReleaseInterface(const std::string& interface_name);
30
31 private:
Peter Qiu267fff32014-12-10 14:01:58 -080032 void OnServiceAvailable(bool service_available);
33 void OnServiceNameChanged(const std::string& old_owner,
34 const std::string& new_owner);
35
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080036 static const char kManagerPath[];
37
38 // Bus object for system bus.
39 scoped_refptr<dbus::Bus> bus_;
40 // DBus proxy for shill manager.
41 std::unique_ptr<org::chromium::flimflam::ManagerProxy> manager_proxy_;
42 // List of interfaces apmanager have claimed.
43 std::set<std::string> claimed_interfaces_;
44
45 DISALLOW_COPY_AND_ASSIGN(ShillProxy);
46};
47
48} // namespace apmanager
49
50#endif // APMANAGER_SHILL_PROXY_H_