blob: 6779d3a387905008e127d9e6d963a6db8157488d [file] [log] [blame]
Peter Qiu326b6cf2015-09-02 11:11:42 -07001//
2// Copyright (C) 2014 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//
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080016
17#ifndef APMANAGER_SHILL_PROXY_H_
18#define APMANAGER_SHILL_PROXY_H_
19
20#include <set>
21#include <string>
22
23#include <base/macros.h>
24#include <base/memory/scoped_ptr.h>
25
26#include "shill/dbus-proxies.h"
27
28// Proxy for shill "org.chromium.flimflam" DBus service.
29namespace apmanager {
30
31class ShillProxy {
32 public:
33 ShillProxy();
34 virtual ~ShillProxy();
35
Peter Qiuc9ce1f12014-12-05 11:14:29 -080036 void Init(const scoped_refptr<dbus::Bus>& bus);
37
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080038 // Claim the given interface |interface_name| from shill.
39 virtual void ClaimInterface(const std::string& interface_name);
40 // Release the given interface |interface_name| to shill.
41 virtual void ReleaseInterface(const std::string& interface_name);
42
43 private:
Peter Qiu267fff32014-12-10 14:01:58 -080044 void OnServiceAvailable(bool service_available);
45 void OnServiceNameChanged(const std::string& old_owner,
46 const std::string& new_owner);
47
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080048 static const char kManagerPath[];
49
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080050 // DBus proxy for shill manager.
51 std::unique_ptr<org::chromium::flimflam::ManagerProxy> manager_proxy_;
52 // List of interfaces apmanager have claimed.
53 std::set<std::string> claimed_interfaces_;
54
55 DISALLOW_COPY_AND_ASSIGN(ShillProxy);
56};
57
58} // namespace apmanager
59
60#endif // APMANAGER_SHILL_PROXY_H_