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

Side by Side Diff: device/bluetooth/bluez/bluetooth_adapter_bluez.cc

Issue 2751223002: bluetooth: Stop support of reconnecting devices not supporting pairing (Closed)
Patch Set: fix an unittest failure Created 3 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
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/bluez/bluetooth_adapter_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdint> 8 #include <cstdint>
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // not need to approve every incoming connection 662 // not need to approve every incoming connection
663 if (property_name == properties->paired.name()) { 663 if (property_name == properties->paired.name()) {
664 if (properties->paired.value() && !properties->trusted.value()) { 664 if (properties->paired.value() && !properties->trusted.value()) {
665 device_bluez->SetTrusted(); 665 device_bluez->SetTrusted();
666 } 666 }
667 NotifyDevicePairedChanged(device_bluez, properties->paired.value()); 667 NotifyDevicePairedChanged(device_bluez, properties->paired.value());
668 } 668 }
669 669
670 // UMA connection counting 670 // UMA connection counting
671 if (property_name == properties->connected.name()) { 671 if (property_name == properties->connected.name()) {
672 // PlayStation joystick tries to reconnect after disconnection from USB.
673 // If it is still not trusted, set it, so it becomes available on the
674 // list of known devices.
675 if (properties->connected.value()) {
676 if (device_bluez->IsTrustable() && !properties->trusted.value())
677 device_bluez->SetTrusted();
678 }
679
680 int count = 0; 672 int count = 0;
681 673
682 for (auto iter = devices_.begin(); iter != devices_.end(); ++iter) { 674 for (auto iter = devices_.begin(); iter != devices_.end(); ++iter) {
683 if (iter->second->IsPaired() && iter->second->IsConnected()) 675 if (iter->second->IsPaired() && iter->second->IsConnected())
684 ++count; 676 ++count;
685 } 677 }
686 678
687 UMA_HISTOGRAM_COUNTS_100("Bluetooth.ConnectedDeviceCount", count); 679 UMA_HISTOGRAM_COUNTS_100("Bluetooth.ConnectedDeviceCount", count);
688 } 680 }
689 } 681 }
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 } else if (error_name == bluetooth_adapter::kErrorAlreadyExists) { 1733 } else if (error_name == bluetooth_adapter::kErrorAlreadyExists) {
1742 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_RECORD_ALREADY_EXISTS; 1734 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_RECORD_ALREADY_EXISTS;
1743 } else if (error_name == bluetooth_adapter::kErrorNotReady) { 1735 } else if (error_name == bluetooth_adapter::kErrorNotReady) {
1744 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_ADAPTER_NOT_READY; 1736 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_ADAPTER_NOT_READY;
1745 } 1737 }
1746 1738
1747 error_callback.Run(code); 1739 error_callback.Run(code);
1748 } 1740 }
1749 1741
1750 } // namespace bluez 1742 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698