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/logging.h" | 10 #include "base/logging.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 property_name == properties->connected.name() || | 386 property_name == properties->connected.name() || |
387 property_name == properties->uuids.name() || | 387 property_name == properties->uuids.name() || |
388 property_name == properties->rssi.name() || | 388 property_name == properties->rssi.name() || |
389 property_name == properties->connection_rssi.name() || | 389 property_name == properties->connection_rssi.name() || |
390 property_name == properties->connection_tx_power.name()) | 390 property_name == properties->connection_tx_power.name()) |
391 NotifyDeviceChanged(device_chromeos); | 391 NotifyDeviceChanged(device_chromeos); |
392 | 392 |
393 // When a device becomes paired, mark it as trusted so that the user does | 393 // When a device becomes paired, mark it as trusted so that the user does |
394 // not need to approve every incoming connection | 394 // not need to approve every incoming connection |
395 if (property_name == properties->paired.name() && | 395 if (property_name == properties->paired.name() && |
396 properties->paired.value()) | 396 properties->paired.value() && !properties->trusted.value()) |
397 device_chromeos->SetTrusted(); | 397 device_chromeos->SetTrusted(); |
398 | 398 |
399 // UMA connection counting | 399 // UMA connection counting |
400 if (property_name == properties->connected.name()) { | 400 if (property_name == properties->connected.name()) { |
| 401 // PlayStation joystick tries to reconnect after disconnection from USB. |
| 402 // If it is still not trusted, set it, so it becomes available on the |
| 403 // list of known devices. |
| 404 if (properties->connected.value() && device_chromeos->IsTrustable() && |
| 405 !properties->trusted.value()) |
| 406 device_chromeos->SetTrusted(); |
| 407 |
401 int count = 0; | 408 int count = 0; |
402 | 409 |
403 for (DevicesMap::iterator iter = devices_.begin(); | 410 for (DevicesMap::iterator iter = devices_.begin(); |
404 iter != devices_.end(); ++iter) { | 411 iter != devices_.end(); ++iter) { |
405 if (iter->second->IsPaired() && iter->second->IsConnected()) | 412 if (iter->second->IsPaired() && iter->second->IsConnected()) |
406 ++count; | 413 ++count; |
407 } | 414 } |
408 | 415 |
409 UMA_HISTOGRAM_COUNTS_100("Bluetooth.ConnectedDeviceCount", count); | 416 UMA_HISTOGRAM_COUNTS_100("Bluetooth.ConnectedDeviceCount", count); |
410 } | 417 } |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 | 940 |
934 // If the queued request resulted in a pending call, then let it | 941 // If the queued request resulted in a pending call, then let it |
935 // asynchonously process the remaining queued requests once the pending | 942 // asynchonously process the remaining queued requests once the pending |
936 // call returns. | 943 // call returns. |
937 if (discovery_request_pending_) | 944 if (discovery_request_pending_) |
938 return; | 945 return; |
939 } | 946 } |
940 } | 947 } |
941 | 948 |
942 } // namespace chromeos | 949 } // namespace chromeos |
OLD | NEW |