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

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

Issue 13872017: Bluetooth: gather usage metrics (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase since Cellular.* appeared under us 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
« no previous file with comments | « chromeos/dbus/fake_bluetooth_device_client.cc ('k') | device/bluetooth/bluetooth_device.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 (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"
11 #include "base/metrics/histogram.h"
11 #include "chromeos/dbus/dbus_thread_manager.h" 12 #include "chromeos/dbus/dbus_thread_manager.h"
12 #include "chromeos/dbus/experimental_bluetooth_adapter_client.h" 13 #include "chromeos/dbus/experimental_bluetooth_adapter_client.h"
13 #include "chromeos/dbus/experimental_bluetooth_device_client.h" 14 #include "chromeos/dbus/experimental_bluetooth_device_client.h"
14 #include "chromeos/dbus/experimental_bluetooth_input_client.h" 15 #include "chromeos/dbus/experimental_bluetooth_input_client.h"
15 #include "device/bluetooth/bluetooth_device.h" 16 #include "device/bluetooth/bluetooth_device.h"
16 #include "device/bluetooth/bluetooth_device_experimental_chromeos.h" 17 #include "device/bluetooth/bluetooth_device_experimental_chromeos.h"
17 18
18 using device::BluetoothAdapter; 19 using device::BluetoothAdapter;
19 using device::BluetoothDevice; 20 using device::BluetoothDevice;
20 21
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 GetProperties(object_path); 247 GetProperties(object_path);
247 248
248 if (property_name == properties->bluetooth_class.name() || 249 if (property_name == properties->bluetooth_class.name() ||
249 property_name == properties->address.name() || 250 property_name == properties->address.name() ||
250 property_name == properties->alias.name() || 251 property_name == properties->alias.name() ||
251 property_name == properties->paired.name() || 252 property_name == properties->paired.name() ||
252 property_name == properties->trusted.name() || 253 property_name == properties->trusted.name() ||
253 property_name == properties->connected.name() || 254 property_name == properties->connected.name() ||
254 property_name == properties->uuids.name()) 255 property_name == properties->uuids.name())
255 NotifyDeviceChanged(device_chromeos); 256 NotifyDeviceChanged(device_chromeos);
257
258 // UMA connection counting
259 if (property_name == properties->connected.name()) {
260 int count = 0;
261
262 for (DevicesMap::iterator iter = devices_.begin();
263 iter != devices_.end(); ++iter) {
264 if (iter->second->IsConnected())
265 ++count;
266 }
267
268 UMA_HISTOGRAM_COUNTS_100("Bluetooth.ConnectedDeviceCount", count);
269 }
256 } 270 }
257 271
258 void BluetoothAdapterExperimentalChromeOS::InputPropertyChanged( 272 void BluetoothAdapterExperimentalChromeOS::InputPropertyChanged(
259 const dbus::ObjectPath& object_path, 273 const dbus::ObjectPath& object_path,
260 const std::string& property_name) { 274 const std::string& property_name) {
261 BluetoothDeviceExperimentalChromeOS* device_chromeos = 275 BluetoothDeviceExperimentalChromeOS* device_chromeos =
262 GetDeviceWithPath(object_path); 276 GetDeviceWithPath(object_path);
263 if (!device_chromeos) 277 if (!device_chromeos)
264 return; 278 return;
265 279
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError( 423 void BluetoothAdapterExperimentalChromeOS::OnStopDiscoveryError(
410 const ErrorCallback& error_callback, 424 const ErrorCallback& error_callback,
411 const std::string& error_name, 425 const std::string& error_name,
412 const std::string& error_message) { 426 const std::string& error_message) {
413 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: " 427 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: "
414 << error_name << ": " << error_message; 428 << error_name << ": " << error_message;
415 error_callback.Run(); 429 error_callback.Run();
416 } 430 }
417 431
418 } // namespace chromeos 432 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_bluetooth_device_client.cc ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698