| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "dbus/object_path.h" | |
| 14 | 13 |
| 15 namespace dbus { | 14 namespace dbus { |
| 16 class Bus; | 15 class Bus; |
| 17 } // namespace dbus | 16 } // namespace dbus |
| 18 | 17 |
| 19 namespace chromeos { | 18 namespace chromeos { |
| 20 | 19 |
| 21 // BluetoothManagerClient is used to communicate with the bluetooth | 20 // BluetoothManagerClient is used to communicate with the bluetooth |
| 22 // daemon's Manager interface. | 21 // daemon's Manager interface. |
| 23 class BluetoothManagerClient { | 22 class BluetoothManagerClient { |
| 24 public: | 23 public: |
| 25 // Interface for observing changes from the bluetooth manager. | 24 // Interface for observing changes from the bluetooth manager. |
| 26 class Observer { | 25 class Observer { |
| 27 public: | 26 public: |
| 28 virtual ~Observer() {} | 27 virtual ~Observer() {} |
| 29 | 28 |
| 30 // Called when a local bluetooth adapter is added. | 29 // Called when a local bluetooth adapter is added. |
| 31 // |object_path| is the dbus object path of the adapter. | 30 // |object_path| is the dbus object path of the adapter. |
| 32 virtual void AdapterAdded(const dbus::ObjectPath& object_path) {} | 31 virtual void AdapterAdded(const std::string& object_path) {} |
| 33 | 32 |
| 34 // Called when a local bluetooth adapter is removed. | 33 // Called when a local bluetooth adapter is removed. |
| 35 // |object_path| is the dbus object path of the adapter. | 34 // |object_path| is the dbus object path of the adapter. |
| 36 virtual void AdapterRemoved(const dbus::ObjectPath& object_path) {} | 35 virtual void AdapterRemoved(const std::string& object_path) {} |
| 37 | 36 |
| 38 // Called when the default local bluetooth adapter changes. | 37 // Called when the default local bluetooth adapter changes. |
| 39 // |object_path| is the dbus object path of the new default adapter. | 38 // |adapter| is the dbus object path of the new default adapter. |
| 40 // Not called if all adapters are removed. | 39 // Not called if all adapters are removed. |
| 41 virtual void DefaultAdapterChanged(const dbus::ObjectPath& object_path) {} | 40 virtual void DefaultAdapterChanged(const std::string& adapter) {} |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 virtual ~BluetoothManagerClient(); | 43 virtual ~BluetoothManagerClient(); |
| 45 | 44 |
| 46 // Adds and removes the observer. | 45 // Adds and removes the observer. |
| 47 virtual void AddObserver(Observer* observer) = 0; | 46 virtual void AddObserver(Observer* observer) = 0; |
| 48 virtual void RemoveObserver(Observer* observer) = 0; | 47 virtual void RemoveObserver(Observer* observer) = 0; |
| 49 | 48 |
| 50 // The DefaultAdapterCallback receives two arguments: | 49 // The DefaultAdapterCallback receives two arguments: |
| 51 // dbus::ObjectPath object_path - the path of the new default adapter | 50 // std::string adapter - the unique identifier of the default adapter |
| 52 // bool success - whether or not the request succeeded | 51 // bool success - whether or not the request succeeded |
| 53 typedef base::Callback<void(const dbus::ObjectPath&, bool)> | 52 typedef base::Callback<void(const std::string&, bool)> |
| 54 DefaultAdapterCallback; | 53 DefaultAdapterCallback; |
| 55 | 54 |
| 56 // Retrieves the dbus object path for the default adapter. | 55 // Retrieves the dbus object path for the default adapter. |
| 57 // The default adapter is the preferred local bluetooth interface when a | 56 // The default adapter is the preferred local bluetooth interface when a |
| 58 // client does not specify a particular interface. | 57 // client does not specify a particular interface. |
| 59 virtual void DefaultAdapter(const DefaultAdapterCallback& callback) = 0; | 58 virtual void DefaultAdapter(const DefaultAdapterCallback& callback) = 0; |
| 60 | 59 |
| 61 // Creates the instance. | 60 // Creates the instance. |
| 62 static BluetoothManagerClient* Create(dbus::Bus* bus); | 61 static BluetoothManagerClient* Create(dbus::Bus* bus); |
| 63 | 62 |
| 64 protected: | 63 protected: |
| 65 BluetoothManagerClient(); | 64 BluetoothManagerClient(); |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 DISALLOW_COPY_AND_ASSIGN(BluetoothManagerClient); | 67 DISALLOW_COPY_AND_ASSIGN(BluetoothManagerClient); |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 } // namespace chromeos | 70 } // namespace chromeos |
| 72 | 71 |
| 73 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |
| OLD | NEW |