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 18 matching lines...) Expand all Loading... |
29 class BluetoothDevice; | 29 class BluetoothDevice; |
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 typedef base::Callback<void()> InitCallback; | 34 typedef base::Callback<void()> InitCallback; |
35 | 35 |
36 // BluetoothAdapter override | 36 // BluetoothAdapter override |
37 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 37 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
38 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 38 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
| 39 virtual std::string address() const OVERRIDE; |
| 40 virtual std::string name() const OVERRIDE; |
39 virtual bool IsInitialized() const OVERRIDE; | 41 virtual bool IsInitialized() const OVERRIDE; |
40 virtual bool IsPresent() const OVERRIDE; | 42 virtual bool IsPresent() const OVERRIDE; |
41 virtual bool IsPowered() const OVERRIDE; | 43 virtual bool IsPowered() const OVERRIDE; |
42 virtual void SetPowered( | 44 virtual void SetPowered( |
43 bool powered, | 45 bool powered, |
44 const base::Closure& callback, | 46 const base::Closure& callback, |
45 const ErrorCallback& error_callback) OVERRIDE; | 47 const ErrorCallback& error_callback) OVERRIDE; |
46 virtual bool IsDiscovering() const OVERRIDE; | 48 virtual bool IsDiscovering() const OVERRIDE; |
47 | 49 |
48 virtual void StartDiscovering( | 50 virtual void StartDiscovering( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 82 |
81 void Init(); | 83 void Init(); |
82 void InitForTest( | 84 void InitForTest( |
83 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 85 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
84 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner); | 86 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner); |
85 | 87 |
86 void MaybePostStartDiscoveryTask(); | 88 void MaybePostStartDiscoveryTask(); |
87 void MaybePostStopDiscoveryTask(); | 89 void MaybePostStopDiscoveryTask(); |
88 | 90 |
89 InitCallback init_callback_; | 91 InitCallback init_callback_; |
| 92 std::string address_; |
| 93 std::string name_; |
90 bool initialized_; | 94 bool initialized_; |
91 bool powered_; | 95 bool powered_; |
92 DiscoveryStatus discovery_status_; | 96 DiscoveryStatus discovery_status_; |
93 | 97 |
94 std::vector<std::pair<base::Closure, ErrorCallback> > | 98 std::vector<std::pair<base::Closure, ErrorCallback> > |
95 on_start_discovery_callbacks_; | 99 on_start_discovery_callbacks_; |
96 std::vector<base::Closure> on_stop_discovery_callbacks_; | 100 std::vector<base::Closure> on_stop_discovery_callbacks_; |
97 size_t num_discovery_listeners_; | 101 size_t num_discovery_listeners_; |
98 | 102 |
99 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 103 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
100 scoped_refptr<BluetoothTaskManagerWin> task_manager_; | 104 scoped_refptr<BluetoothTaskManagerWin> task_manager_; |
101 | 105 |
102 base::ThreadChecker thread_checker_; | 106 base::ThreadChecker thread_checker_; |
103 | 107 |
104 // List of observers interested in event notifications from us. | 108 // List of observers interested in event notifications from us. |
105 ObserverList<BluetoothAdapter::Observer> observers_; | 109 ObserverList<BluetoothAdapter::Observer> observers_; |
106 | 110 |
107 // NOTE: This should remain the last member so it'll be destroyed and | 111 // NOTE: This should remain the last member so it'll be destroyed and |
108 // invalidate its weak pointers before any other members are destroyed. | 112 // invalidate its weak pointers before any other members are destroyed. |
109 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; | 113 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); | 115 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace device | 118 } // namespace device |
115 | 119 |
116 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 120 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
OLD | NEW |