OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 5 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
14 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
15 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
16 #include "chromeos/dbus/bluetooth_adapter_client.h" | 17 #include "chromeos/dbus/bluetooth_adapter_client.h" |
17 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 18 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
18 #include "chromeos/dbus/bluetooth_agent_service_provider.h" | 19 #include "chromeos/dbus/bluetooth_agent_service_provider.h" |
19 #include "chromeos/dbus/bluetooth_device_client.h" | 20 #include "chromeos/dbus/bluetooth_device_client.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DBusThreadManager::Get()->GetBluetoothInputClient()->RemoveObserver(this); | 104 DBusThreadManager::Get()->GetBluetoothInputClient()->RemoveObserver(this); |
104 | 105 |
105 VLOG(1) << "Unregistering pairing agent"; | 106 VLOG(1) << "Unregistering pairing agent"; |
106 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()-> | 107 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()-> |
107 UnregisterAgent( | 108 UnregisterAgent( |
108 dbus::ObjectPath(kAgentPath), | 109 dbus::ObjectPath(kAgentPath), |
109 base::Bind(&base::DoNothing), | 110 base::Bind(&base::DoNothing), |
110 base::Bind(&OnUnregisterAgentError)); | 111 base::Bind(&OnUnregisterAgentError)); |
111 } | 112 } |
112 | 113 |
| 114 void BluetoothAdapterChromeOS::DeleteOnCorrectThread() const { |
| 115 if (!ui_task_runner_->DeleteSoon(FROM_HERE, this)) |
| 116 delete this; |
| 117 } |
| 118 |
113 void BluetoothAdapterChromeOS::AddObserver( | 119 void BluetoothAdapterChromeOS::AddObserver( |
114 BluetoothAdapter::Observer* observer) { | 120 BluetoothAdapter::Observer* observer) { |
115 DCHECK(observer); | 121 DCHECK(observer); |
116 observers_.AddObserver(observer); | 122 observers_.AddObserver(observer); |
117 } | 123 } |
118 | 124 |
119 void BluetoothAdapterChromeOS::RemoveObserver( | 125 void BluetoothAdapterChromeOS::RemoveObserver( |
120 BluetoothAdapter::Observer* observer) { | 126 BluetoothAdapter::Observer* observer) { |
121 DCHECK(observer); | 127 DCHECK(observer); |
122 observers_.RemoveObserver(observer); | 128 observers_.RemoveObserver(observer); |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 | 1069 |
1064 // If the queued request resulted in a pending call, then let it | 1070 // If the queued request resulted in a pending call, then let it |
1065 // asynchonously process the remaining queued requests once the pending | 1071 // asynchonously process the remaining queued requests once the pending |
1066 // call returns. | 1072 // call returns. |
1067 if (discovery_request_pending_) | 1073 if (discovery_request_pending_) |
1068 return; | 1074 return; |
1069 } | 1075 } |
1070 } | 1076 } |
1071 | 1077 |
1072 } // namespace chromeos | 1078 } // namespace chromeos |
OLD | NEW |