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

Side by Side Diff: chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc

Issue 9826018: Expose the bluetooth address of the adapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 ClearDevices(); 107 ClearDevices();
108 } 108 }
109 109
110 object_path_ = adapter_path; 110 object_path_ = adapter_path;
111 111
112 // Update properties to their new values. 112 // Update properties to their new values.
113 BluetoothAdapterClient::Properties* properties = 113 BluetoothAdapterClient::Properties* properties =
114 DBusThreadManager::Get()->GetBluetoothAdapterClient()-> 114 DBusThreadManager::Get()->GetBluetoothAdapterClient()->
115 GetProperties(object_path_); 115 GetProperties(object_path_);
116 116
117 address_ = properties->address.value();
118
117 PoweredChanged(properties->powered.value()); 119 PoweredChanged(properties->powered.value());
118 DiscoveringChanged(properties->discovering.value()); 120 DiscoveringChanged(properties->discovering.value());
119 DevicesChanged(properties->devices.value()); 121 DevicesChanged(properties->devices.value());
120 122
121 // Notify observers if we did not have an adapter before, the case of 123 // Notify observers if we did not have an adapter before, the case of
122 // moving from one to another is hidden from layers above. 124 // moving from one to another is hidden from layers above.
123 if (!was_present) { 125 if (!was_present) {
124 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 126 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
125 AdapterPresentChanged(this, true)); 127 AdapterPresentChanged(this, true));
126 } 128 }
127 } 129 }
128 130
129 void BluetoothAdapter::RemoveAdapter() { 131 void BluetoothAdapter::RemoveAdapter() {
130 DVLOG(1) << "Adapter lost."; 132 DVLOG(1) << "Adapter lost.";
131 PoweredChanged(false); 133 PoweredChanged(false);
132 DiscoveringChanged(false); 134 DiscoveringChanged(false);
133 ClearDevices(); 135 ClearDevices();
134 136
135 object_path_ = dbus::ObjectPath(""); 137 object_path_ = dbus::ObjectPath("");
138 address_.clear();
136 139
137 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 140 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
138 AdapterPresentChanged(this, false)); 141 AdapterPresentChanged(this, false));
139 } 142 }
140 143
141 bool BluetoothAdapter::IsPresent() const { 144 bool BluetoothAdapter::IsPresent() const {
142 return !object_path_.value().empty(); 145 return !object_path_.value().empty();
143 } 146 }
144 147
145 bool BluetoothAdapter::IsPowered() const { 148 bool BluetoothAdapter::IsPowered() const {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 443 }
441 444
442 // static 445 // static
443 BluetoothAdapter* BluetoothAdapter::Create(const std::string& address) { 446 BluetoothAdapter* BluetoothAdapter::Create(const std::string& address) {
444 BluetoothAdapter* adapter = new BluetoothAdapter; 447 BluetoothAdapter* adapter = new BluetoothAdapter;
445 adapter->FindAdapter(address); 448 adapter->FindAdapter(address);
446 return adapter; 449 return adapter;
447 } 450 }
448 451
449 } // namespace chromeos 452 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698