| 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 DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class BluetoothDevice; | 28 class BluetoothDevice; |
| 29 class BluetoothSocketThread; | 29 class BluetoothSocketThread; |
| 30 | 30 |
| 31 class BluetoothAdapterWin : public BluetoothAdapter, | 31 class BluetoothAdapterWin : public BluetoothAdapter, |
| 32 public BluetoothTaskManagerWin::Observer { | 32 public BluetoothTaskManagerWin::Observer { |
| 33 public: | 33 public: |
| 34 static base::WeakPtr<BluetoothAdapter> CreateAdapter( | 34 static base::WeakPtr<BluetoothAdapter> CreateAdapter( |
| 35 const InitCallback& init_callback); | 35 const InitCallback& init_callback); |
| 36 | 36 |
| 37 // BluetoothAdapter: | 37 // BluetoothAdapter: |
| 38 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 38 virtual void AddObserver(BluetoothAdapter::Observer* observer) override; |
| 39 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 39 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) override; |
| 40 virtual std::string GetAddress() const OVERRIDE; | 40 virtual std::string GetAddress() const override; |
| 41 virtual std::string GetName() const OVERRIDE; | 41 virtual std::string GetName() const override; |
| 42 virtual void SetName(const std::string& name, | 42 virtual void SetName(const std::string& name, |
| 43 const base::Closure& callback, | 43 const base::Closure& callback, |
| 44 const ErrorCallback& error_callback) OVERRIDE; | 44 const ErrorCallback& error_callback) override; |
| 45 virtual bool IsInitialized() const OVERRIDE; | 45 virtual bool IsInitialized() const override; |
| 46 virtual bool IsPresent() const OVERRIDE; | 46 virtual bool IsPresent() const override; |
| 47 virtual bool IsPowered() const OVERRIDE; | 47 virtual bool IsPowered() const override; |
| 48 virtual void SetPowered( | 48 virtual void SetPowered( |
| 49 bool discoverable, | 49 bool discoverable, |
| 50 const base::Closure& callback, | 50 const base::Closure& callback, |
| 51 const ErrorCallback& error_callback) OVERRIDE; | 51 const ErrorCallback& error_callback) override; |
| 52 virtual bool IsDiscoverable() const OVERRIDE; | 52 virtual bool IsDiscoverable() const override; |
| 53 virtual void SetDiscoverable( | 53 virtual void SetDiscoverable( |
| 54 bool discoverable, | 54 bool discoverable, |
| 55 const base::Closure& callback, | 55 const base::Closure& callback, |
| 56 const ErrorCallback& error_callback) OVERRIDE; | 56 const ErrorCallback& error_callback) override; |
| 57 virtual bool IsDiscovering() const OVERRIDE; | 57 virtual bool IsDiscovering() const override; |
| 58 virtual void CreateRfcommService( | 58 virtual void CreateRfcommService( |
| 59 const BluetoothUUID& uuid, | 59 const BluetoothUUID& uuid, |
| 60 const ServiceOptions& options, | 60 const ServiceOptions& options, |
| 61 const CreateServiceCallback& callback, | 61 const CreateServiceCallback& callback, |
| 62 const CreateServiceErrorCallback& error_callback) OVERRIDE; | 62 const CreateServiceErrorCallback& error_callback) override; |
| 63 virtual void CreateL2capService( | 63 virtual void CreateL2capService( |
| 64 const BluetoothUUID& uuid, | 64 const BluetoothUUID& uuid, |
| 65 const ServiceOptions& options, | 65 const ServiceOptions& options, |
| 66 const CreateServiceCallback& callback, | 66 const CreateServiceCallback& callback, |
| 67 const CreateServiceErrorCallback& error_callback) OVERRIDE; | 67 const CreateServiceErrorCallback& error_callback) override; |
| 68 | 68 |
| 69 // BluetoothTaskManagerWin::Observer override | 69 // BluetoothTaskManagerWin::Observer override |
| 70 virtual void AdapterStateChanged( | 70 virtual void AdapterStateChanged( |
| 71 const BluetoothTaskManagerWin::AdapterState& state) OVERRIDE; | 71 const BluetoothTaskManagerWin::AdapterState& state) override; |
| 72 virtual void DiscoveryStarted(bool success) OVERRIDE; | 72 virtual void DiscoveryStarted(bool success) override; |
| 73 virtual void DiscoveryStopped() OVERRIDE; | 73 virtual void DiscoveryStopped() override; |
| 74 virtual void DevicesPolled(const ScopedVector< | 74 virtual void DevicesPolled(const ScopedVector< |
| 75 BluetoothTaskManagerWin::DeviceState>& devices) OVERRIDE; | 75 BluetoothTaskManagerWin::DeviceState>& devices) override; |
| 76 | 76 |
| 77 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner() const { | 77 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner() const { |
| 78 return ui_task_runner_; | 78 return ui_task_runner_; |
| 79 } | 79 } |
| 80 const scoped_refptr<BluetoothSocketThread>& socket_thread() const { | 80 const scoped_refptr<BluetoothSocketThread>& socket_thread() const { |
| 81 return socket_thread_; | 81 return socket_thread_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 protected: | 84 protected: |
| 85 // BluetoothAdapter: | 85 // BluetoothAdapter: |
| 86 virtual void RemovePairingDelegateInternal( | 86 virtual void RemovePairingDelegateInternal( |
| 87 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; | 87 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 friend class BluetoothAdapterWinTest; | 90 friend class BluetoothAdapterWinTest; |
| 91 | 91 |
| 92 enum DiscoveryStatus { | 92 enum DiscoveryStatus { |
| 93 NOT_DISCOVERING, | 93 NOT_DISCOVERING, |
| 94 DISCOVERY_STARTING, | 94 DISCOVERY_STARTING, |
| 95 DISCOVERING, | 95 DISCOVERING, |
| 96 DISCOVERY_STOPPING | 96 DISCOVERY_STOPPING |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 explicit BluetoothAdapterWin(const InitCallback& init_callback); | 99 explicit BluetoothAdapterWin(const InitCallback& init_callback); |
| 100 virtual ~BluetoothAdapterWin(); | 100 virtual ~BluetoothAdapterWin(); |
| 101 | 101 |
| 102 // BluetoothAdapter: | 102 // BluetoothAdapter: |
| 103 virtual void AddDiscoverySession( | 103 virtual void AddDiscoverySession( |
| 104 const base::Closure& callback, | 104 const base::Closure& callback, |
| 105 const ErrorCallback& error_callback) OVERRIDE; | 105 const ErrorCallback& error_callback) override; |
| 106 virtual void RemoveDiscoverySession( | 106 virtual void RemoveDiscoverySession( |
| 107 const base::Closure& callback, | 107 const base::Closure& callback, |
| 108 const ErrorCallback& error_callback) OVERRIDE; | 108 const ErrorCallback& error_callback) override; |
| 109 | 109 |
| 110 void Init(); | 110 void Init(); |
| 111 void InitForTest( | 111 void InitForTest( |
| 112 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 112 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 113 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner); | 113 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner); |
| 114 | 114 |
| 115 void MaybePostStartDiscoveryTask(); | 115 void MaybePostStartDiscoveryTask(); |
| 116 void MaybePostStopDiscoveryTask(); | 116 void MaybePostStopDiscoveryTask(); |
| 117 | 117 |
| 118 InitCallback init_callback_; | 118 InitCallback init_callback_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 140 // NOTE: This should remain the last member so it'll be destroyed and | 140 // NOTE: This should remain the last member so it'll be destroyed and |
| 141 // invalidate its weak pointers before any other members are destroyed. | 141 // invalidate its weak pointers before any other members are destroyed. |
| 142 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; | 142 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); | 144 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace device | 147 } // namespace device |
| 148 | 148 |
| 149 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 149 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
| OLD | NEW |