blob: 661642f9a8dcdb724fa43c397998c3642d38d6c9 [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
Peter Qiu2a6fb332015-09-17 22:19:17 -070017#ifndef APMANAGER_SHILL_MANAGER_H_
18#define APMANAGER_SHILL_MANAGER_H_
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080019
20#include <set>
21#include <string>
22
23#include <base/macros.h>
24#include <base/memory/scoped_ptr.h>
Peter Qiu25c7e102015-09-08 09:25:14 -070025#include <shill/dbus-proxies.h>
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080026
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080027namespace apmanager {
28
Peter Qiu2a6fb332015-09-17 22:19:17 -070029class ShillManager {
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080030 public:
Peter Qiu2a6fb332015-09-17 22:19:17 -070031 ShillManager();
32 virtual ~ShillManager();
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080033
Peter Qiuc9ce1f12014-12-05 11:14:29 -080034 void Init(const scoped_refptr<dbus::Bus>& bus);
35
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080036 // Claim the given interface |interface_name| from shill.
37 virtual void ClaimInterface(const std::string& interface_name);
38 // Release the given interface |interface_name| to shill.
39 virtual void ReleaseInterface(const std::string& interface_name);
40
41 private:
Peter Qiu267fff32014-12-10 14:01:58 -080042 void OnServiceAvailable(bool service_available);
43 void OnServiceNameChanged(const std::string& old_owner,
44 const std::string& new_owner);
45
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080046 // DBus proxy for shill manager.
47 std::unique_ptr<org::chromium::flimflam::ManagerProxy> manager_proxy_;
48 // List of interfaces apmanager have claimed.
49 std::set<std::string> claimed_interfaces_;
50
Peter Qiu2a6fb332015-09-17 22:19:17 -070051 DISALLOW_COPY_AND_ASSIGN(ShillManager);
Peter Qiu7e0ffcf2014-12-02 12:53:27 -080052};
53
54} // namespace apmanager
55
Peter Qiu2a6fb332015-09-17 22:19:17 -070056#endif // APMANAGER_SHILL_MANAGER_H_