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_TASK_MANAGER_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ScopedVector<ServiceRecordState> service_record_states; | 56 ScopedVector<ServiceRecordState> service_record_states; |
57 }; | 57 }; |
58 | 58 |
59 class Observer { | 59 class Observer { |
60 public: | 60 public: |
61 virtual ~Observer() {} | 61 virtual ~Observer() {} |
62 | 62 |
63 virtual void AdapterStateChanged(const AdapterState& state) {} | 63 virtual void AdapterStateChanged(const AdapterState& state) {} |
64 virtual void DiscoveryStarted(bool success) {} | 64 virtual void DiscoveryStarted(bool success) {} |
65 virtual void DiscoveryStopped() {} | 65 virtual void DiscoveryStopped() {} |
| 66 virtual void DevicesUpdated(const ScopedVector<DeviceState>& devices) {} |
66 virtual void DevicesDiscovered(const ScopedVector<DeviceState>& devices) {} | 67 virtual void DevicesDiscovered(const ScopedVector<DeviceState>& devices) {} |
67 }; | 68 }; |
68 | 69 |
69 explicit BluetoothTaskManagerWin( | 70 explicit BluetoothTaskManagerWin( |
70 scoped_refptr<base::SequencedTaskRunner> ui_task_runner); | 71 scoped_refptr<base::SequencedTaskRunner> ui_task_runner); |
71 | 72 |
72 void AddObserver(Observer* observer); | 73 void AddObserver(Observer* observer); |
73 void RemoveObserver(Observer* observer); | 74 void RemoveObserver(Observer* observer); |
74 | 75 |
75 void Initialize(); | 76 void Initialize(); |
(...skipping 14 matching lines...) Expand all Loading... |
90 | 91 |
91 static const int kPollIntervalMs; | 92 static const int kPollIntervalMs; |
92 | 93 |
93 virtual ~BluetoothTaskManagerWin(); | 94 virtual ~BluetoothTaskManagerWin(); |
94 | 95 |
95 // Notify all Observers of updated AdapterState. Should only be called on the | 96 // Notify all Observers of updated AdapterState. Should only be called on the |
96 // UI thread. | 97 // UI thread. |
97 void OnAdapterStateChanged(const AdapterState* state); | 98 void OnAdapterStateChanged(const AdapterState* state); |
98 void OnDiscoveryStarted(bool success); | 99 void OnDiscoveryStarted(bool success); |
99 void OnDiscoveryStopped(); | 100 void OnDiscoveryStopped(); |
| 101 void OnDevicesUpdated(const ScopedVector<DeviceState>* devices); |
100 void OnDevicesDiscovered(const ScopedVector<DeviceState>* devices); | 102 void OnDevicesDiscovered(const ScopedVector<DeviceState>* devices); |
101 | 103 |
102 // Called on BluetoothTaskRunner. | 104 // Called on BluetoothTaskRunner. |
103 void StartPolling(); | 105 void StartPolling(); |
104 void PollAdapter(); | 106 void PollAdapter(); |
105 void PostAdapterStateToUi(); | 107 void PostAdapterStateToUi(); |
106 void SetPowered(bool powered, | 108 void SetPowered(bool powered, |
107 const base::Closure& callback, | 109 const base::Closure& callback, |
108 const BluetoothAdapter::ErrorCallback& error_callback); | 110 const BluetoothAdapter::ErrorCallback& error_callback); |
109 | 111 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 148 |
147 // indicates whether the adapter is in discovery mode or not. | 149 // indicates whether the adapter is in discovery mode or not. |
148 bool discovering_; | 150 bool discovering_; |
149 | 151 |
150 DISALLOW_COPY_AND_ASSIGN(BluetoothTaskManagerWin); | 152 DISALLOW_COPY_AND_ASSIGN(BluetoothTaskManagerWin); |
151 }; | 153 }; |
152 | 154 |
153 } // namespace device | 155 } // namespace device |
154 | 156 |
155 #endif // DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ | 157 #endif // DEVICE_BLUETOOTH_BLUETOOTH_TASK_MANAGER_WIN_H_ |
OLD | NEW |