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_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | |
16 #include "chromeos/dbus/bluetooth_adapter_client.h" | 15 #include "chromeos/dbus/bluetooth_adapter_client.h" |
17 #include "chromeos/dbus/bluetooth_device_client.h" | 16 #include "chromeos/dbus/bluetooth_device_client.h" |
18 #include "chromeos/dbus/bluetooth_manager_client.h" | 17 #include "chromeos/dbus/bluetooth_manager_client.h" |
19 #include "dbus/object_path.h" | 18 #include "dbus/object_path.h" |
19 #include "device/bluetooth/bluetooth_adapter.h" | |
20 | 20 |
21 namespace chromeos { | 21 namespace bluetooth { |
keybuk
2012/10/12 00:13:18
should this namespace change? this is still chrome
youngki
2012/10/12 01:50:12
Done.
| |
22 | 22 |
23 class BluetoothDeviceChromeOs; | 23 class BluetoothDeviceChromeOs; |
24 | 24 |
25 struct BluetoothOutOfBandPairingData; | 25 struct BluetoothOutOfBandPairingData; |
26 | 26 |
27 // The BluetoothAdapterChromeOs class is an implementation of BluetoothAdapter | 27 // The BluetoothAdapterChromeOs class is an implementation of BluetoothAdapter |
28 // for Chrome OS platform. | 28 // for Chrome OS platform. |
29 class BluetoothAdapterChromeOs : public BluetoothAdapter, | 29 class BluetoothAdapterChromeOs |
30 public BluetoothManagerClient::Observer, | 30 : public BluetoothAdapter, |
31 public BluetoothAdapterClient::Observer, | 31 public chromeos::BluetoothManagerClient::Observer, |
32 public BluetoothDeviceClient::Observer { | 32 public chromeos::BluetoothAdapterClient::Observer, |
33 public chromeos::BluetoothDeviceClient::Observer { | |
33 public: | 34 public: |
34 // BluetoothAdapter override | 35 // BluetoothAdapter override |
35 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 36 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
36 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 37 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
37 virtual bool IsPresent() const OVERRIDE; | 38 virtual bool IsPresent() const OVERRIDE; |
38 virtual bool IsPowered() const OVERRIDE; | 39 virtual bool IsPowered() const OVERRIDE; |
39 virtual void SetPowered( | 40 virtual void SetPowered( |
40 bool powered, | 41 bool powered, |
41 const base::Closure& callback, | 42 const base::Closure& callback, |
42 const ErrorCallback& error_callback) OVERRIDE; | 43 const ErrorCallback& error_callback) OVERRIDE; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 // | 183 // |
183 // Called when the adapter with object path |object_path| discovers | 184 // Called when the adapter with object path |object_path| discovers |
184 // a new remote device with address |address| and properties | 185 // a new remote device with address |address| and properties |
185 // |properties|, there is no device object path until connected. | 186 // |properties|, there is no device object path until connected. |
186 // | 187 // |
187 // |properties| supports only value() calls, not Get() or Set(), and | 188 // |properties| supports only value() calls, not Get() or Set(), and |
188 // should be copied if needed. | 189 // should be copied if needed. |
189 virtual void DeviceFound( | 190 virtual void DeviceFound( |
190 const dbus::ObjectPath& adapter_path, | 191 const dbus::ObjectPath& adapter_path, |
191 const std::string& address, | 192 const std::string& address, |
192 const BluetoothDeviceClient::Properties& properties) OVERRIDE; | 193 const chromeos::BluetoothDeviceClient::Properties& properties) OVERRIDE; |
193 | 194 |
194 // BluetoothAdapterClient::Observer override. | 195 // BluetoothAdapterClient::Observer override. |
195 // | 196 // |
196 // Called when the adapter with object path |object_path| can no | 197 // Called when the adapter with object path |object_path| can no |
197 // longer communicate with the discovered removed device with | 198 // longer communicate with the discovered removed device with |
198 // address |address|. | 199 // address |address|. |
199 virtual void DeviceDisappeared(const dbus::ObjectPath& object_path, | 200 virtual void DeviceDisappeared(const dbus::ObjectPath& object_path, |
200 const std::string& address) OVERRIDE; | 201 const std::string& address) OVERRIDE; |
201 | 202 |
202 // List of observers interested in event notifications from us. | 203 // List of observers interested in event notifications from us. |
(...skipping 17 matching lines...) Expand all Loading... | |
220 typedef std::map<const std::string, BluetoothDeviceChromeOs*> DevicesMap; | 221 typedef std::map<const std::string, BluetoothDeviceChromeOs*> DevicesMap; |
221 DevicesMap devices_; | 222 DevicesMap devices_; |
222 | 223 |
223 // Note: This should remain the last member so it'll be destroyed and | 224 // Note: This should remain the last member so it'll be destroyed and |
224 // invalidate its weak pointers before any other members are destroyed. | 225 // invalidate its weak pointers before any other members are destroyed. |
225 base::WeakPtrFactory<BluetoothAdapterChromeOs> weak_ptr_factory_; | 226 base::WeakPtrFactory<BluetoothAdapterChromeOs> weak_ptr_factory_; |
226 | 227 |
227 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOs); | 228 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOs); |
228 }; | 229 }; |
229 | 230 |
230 } // namespace chromeos | 231 } // namespace bluetooth |
231 | 232 |
232 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 233 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
OLD | NEW |