Peter Qiu | 7e0ffcf | 2014-12-02 12:53:27 -0800 | [diff] [blame] | 1 | // 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. |
| 17 | namespace apmanager { |
| 18 | |
| 19 | class ShillProxy { |
| 20 | public: |
| 21 | ShillProxy(); |
| 22 | virtual ~ShillProxy(); |
| 23 | |
Peter Qiu | c9ce1f1 | 2014-12-05 11:14:29 -0800 | [diff] [blame] | 24 | void Init(const scoped_refptr<dbus::Bus>& bus); |
| 25 | |
Peter Qiu | 7e0ffcf | 2014-12-02 12:53:27 -0800 | [diff] [blame] | 26 | // 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 Qiu | 267fff3 | 2014-12-10 14:01:58 -0800 | [diff] [blame^] | 32 | void OnServiceAvailable(bool service_available); |
| 33 | void OnServiceNameChanged(const std::string& old_owner, |
| 34 | const std::string& new_owner); |
| 35 | |
Peter Qiu | 7e0ffcf | 2014-12-02 12:53:27 -0800 | [diff] [blame] | 36 | 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_ |