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

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

Issue 14199010: Bluetooth: call DeviceChanged observer method on IsConnecting() change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_experimental_chromeos.h" 5 #include "device/bluetooth/bluetooth_adapter_experimental_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/logging.h" 10 #include "base/logging.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return; 237 return;
238 238
239 ExperimentalBluetoothDeviceClient::Properties* properties = 239 ExperimentalBluetoothDeviceClient::Properties* properties =
240 DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> 240 DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()->
241 GetProperties(object_path); 241 GetProperties(object_path);
242 242
243 if (property_name == properties->bluetooth_class.name() || 243 if (property_name == properties->bluetooth_class.name() ||
244 property_name == properties->alias.name() || 244 property_name == properties->alias.name() ||
245 property_name == properties->paired.name() || 245 property_name == properties->paired.name() ||
246 property_name == properties->connected.name() || 246 property_name == properties->connected.name() ||
247 property_name == properties->uuids.name()) { 247 property_name == properties->uuids.name())
248 FOR_EACH_OBSERVER( 248 NotifyDeviceChanged(device_chromeos);
249 BluetoothAdapter::Observer, observers_,
250 DeviceChanged(this, device_chromeos));
251 }
252 } 249 }
253 250
254 BluetoothDeviceExperimentalChromeOS* 251 BluetoothDeviceExperimentalChromeOS*
255 BluetoothAdapterExperimentalChromeOS::GetDeviceWithPath( 252 BluetoothAdapterExperimentalChromeOS::GetDeviceWithPath(
256 const dbus::ObjectPath& object_path) { 253 const dbus::ObjectPath& object_path) {
257 for (DevicesMap::iterator iter = devices_.begin(); 254 for (DevicesMap::iterator iter = devices_.begin();
258 iter != devices_.end(); ++iter) { 255 iter != devices_.end(); ++iter) {
259 BluetoothDeviceExperimentalChromeOS* device_chromeos = 256 BluetoothDeviceExperimentalChromeOS* device_chromeos =
260 static_cast<BluetoothDeviceExperimentalChromeOS*>(iter->second); 257 static_cast<BluetoothDeviceExperimentalChromeOS*>(iter->second);
261 if (device_chromeos->object_path() == object_path) 258 if (device_chromeos->object_path() == object_path)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 bool discovering) { 335 bool discovering) {
339 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 336 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
340 AdapterDiscoveringChanged(this, discovering)); 337 AdapterDiscoveringChanged(this, discovering));
341 } 338 }
342 339
343 void BluetoothAdapterExperimentalChromeOS::PresentChanged(bool present) { 340 void BluetoothAdapterExperimentalChromeOS::PresentChanged(bool present) {
344 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 341 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
345 AdapterPresentChanged(this, present)); 342 AdapterPresentChanged(this, present));
346 } 343 }
347 344
345 void BluetoothAdapterExperimentalChromeOS::NotifyDeviceChanged(
346 BluetoothDeviceExperimentalChromeOS* device) {
347 DCHECK(device->adapter_ == this);
348
349 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
350 DeviceChanged(this, device));
351 }
352
348 void BluetoothAdapterExperimentalChromeOS::OnSetPowered( 353 void BluetoothAdapterExperimentalChromeOS::OnSetPowered(
349 const base::Closure& callback, 354 const base::Closure& callback,
350 const ErrorCallback& error_callback, 355 const ErrorCallback& error_callback,
351 bool success) { 356 bool success) {
352 if (success) 357 if (success)
353 callback.Run(); 358 callback.Run();
354 else 359 else
355 error_callback.Run(); 360 error_callback.Run();
356 } 361 }
357 362
(...skipping 19 matching lines...) Expand all
377 void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError( 382 void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError(
378 const ErrorCallback& error_callback, 383 const ErrorCallback& error_callback,
379 const std::string& error_name, 384 const std::string& error_name,
380 const std::string& error_message) { 385 const std::string& error_message) {
381 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: " 386 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: "
382 << error_name << ": " << error_message; 387 << error_name << ": " << error_message;
383 error_callback.Run(); 388 error_callback.Run();
384 } 389 }
385 390
386 } // namespace chromeos 391 } // namespace chromeos
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_experimental_chromeos.h ('k') | device/bluetooth/bluetooth_device_experimental_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698