Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: device/bluetooth/bluetooth_adapter_chromeos.cc

Issue 1057603004: bluetooth: Refactor (Add|Remove)Observer impls into BluetoothAdapter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-style-guide-ordering-
Patch Set: Merge TOT Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter_chromeos.h ('k') | device/bluetooth/bluetooth_adapter_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/location.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 BluetoothAdapterChromeOS::~BluetoothAdapterChromeOS() { 137 BluetoothAdapterChromeOS::~BluetoothAdapterChromeOS() {
138 Shutdown(); 138 Shutdown();
139 } 139 }
140 140
141 void BluetoothAdapterChromeOS::DeleteOnCorrectThread() const { 141 void BluetoothAdapterChromeOS::DeleteOnCorrectThread() const {
142 if (ui_task_runner_->RunsTasksOnCurrentThread() || 142 if (ui_task_runner_->RunsTasksOnCurrentThread() ||
143 !ui_task_runner_->DeleteSoon(FROM_HERE, this)) 143 !ui_task_runner_->DeleteSoon(FROM_HERE, this))
144 delete this; 144 delete this;
145 } 145 }
146 146
147 void BluetoothAdapterChromeOS::AddObserver(
148 BluetoothAdapter::Observer* observer) {
149 DCHECK(observer);
150 observers_.AddObserver(observer);
151 }
152
153 void BluetoothAdapterChromeOS::RemoveObserver(
154 BluetoothAdapter::Observer* observer) {
155 DCHECK(observer);
156 observers_.RemoveObserver(observer);
157 }
158
159 std::string BluetoothAdapterChromeOS::GetAddress() const { 147 std::string BluetoothAdapterChromeOS::GetAddress() const {
160 if (!IsPresent()) 148 if (!IsPresent())
161 return std::string(); 149 return std::string();
162 150
163 BluetoothAdapterClient::Properties* properties = 151 BluetoothAdapterClient::Properties* properties =
164 DBusThreadManager::Get()->GetBluetoothAdapterClient()-> 152 DBusThreadManager::Get()->GetBluetoothAdapterClient()->
165 GetProperties(object_path_); 153 GetProperties(object_path_);
166 DCHECK(properties); 154 DCHECK(properties);
167 155
168 return BluetoothDevice::CanonicalizeAddress(properties->address.value()); 156 return BluetoothDevice::CanonicalizeAddress(properties->address.value());
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 1409
1422 // If the queued request resulted in a pending call, then let it 1410 // If the queued request resulted in a pending call, then let it
1423 // asynchonously process the remaining queued requests once the pending 1411 // asynchonously process the remaining queued requests once the pending
1424 // call returns. 1412 // call returns.
1425 if (discovery_request_pending_) 1413 if (discovery_request_pending_)
1426 return; 1414 return;
1427 } 1415 }
1428 } 1416 }
1429 1417
1430 } // namespace chromeos 1418 } // namespace chromeos
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_chromeos.h ('k') | device/bluetooth/bluetooth_adapter_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698