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

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

Issue 14316006: Bluetooth: Show trusted devices as paired. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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
« no previous file with comments | « device/bluetooth/bluetooth_device_chromeos.h ('k') | no next file » | 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) 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 "device/bluetooth/bluetooth_device_chromeos.h" 5 #include "device/bluetooth/bluetooth_device_chromeos.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } // namespace 45 } // namespace
46 46
47 namespace chromeos { 47 namespace chromeos {
48 48
49 BluetoothDeviceChromeOS::BluetoothDeviceChromeOS( 49 BluetoothDeviceChromeOS::BluetoothDeviceChromeOS(
50 BluetoothAdapterChromeOS* adapter) 50 BluetoothAdapterChromeOS* adapter)
51 : BluetoothDevice(), 51 : BluetoothDevice(),
52 adapter_(adapter), 52 adapter_(adapter),
53 bluetooth_class_(0), 53 bluetooth_class_(0),
54 paired_(false), 54 paired_(false),
55 trusted_(false),
55 connected_(false), 56 connected_(false),
56 connectable_(true), 57 connectable_(true),
57 connecting_(false), 58 connecting_(false),
58 pairing_delegate_(NULL), 59 pairing_delegate_(NULL),
59 connecting_applications_counter_(0), 60 connecting_applications_counter_(0),
60 connecting_calls_(0), 61 connecting_calls_(0),
61 service_records_loaded_(false), 62 service_records_loaded_(false),
62 weak_ptr_factory_(this) { 63 weak_ptr_factory_(this) {
63 } 64 }
64 65
65 BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() { 66 BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() {
66 } 67 }
67 68
68 uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const { 69 uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const {
69 return bluetooth_class_; 70 return bluetooth_class_;
70 } 71 }
71 72
72 std::string BluetoothDeviceChromeOS::GetDeviceName() const { 73 std::string BluetoothDeviceChromeOS::GetDeviceName() const {
73 return name_; 74 return name_;
74 } 75 }
75 76
76 std::string BluetoothDeviceChromeOS::GetAddress() const { 77 std::string BluetoothDeviceChromeOS::GetAddress() const {
77 return address_; 78 return address_;
78 } 79 }
79 80
80 bool BluetoothDeviceChromeOS::IsPaired() const { 81 bool BluetoothDeviceChromeOS::IsPaired() const {
81 return paired_; 82 return paired_ || trusted_;
82 } 83 }
83 84
84 bool BluetoothDeviceChromeOS::IsConnected() const { 85 bool BluetoothDeviceChromeOS::IsConnected() const {
85 return connected_; 86 return connected_;
86 } 87 }
87 88
88 bool BluetoothDeviceChromeOS::IsConnectable() const { 89 bool BluetoothDeviceChromeOS::IsConnectable() const {
89 return connectable_; 90 return connectable_;
90 } 91 }
91 92
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 384
384 if (update_state) { 385 if (update_state) {
385 // When the device reconnects and we don't have any service records for it, 386 // When the device reconnects and we don't have any service records for it,
386 // try to update the cache or fail silently. 387 // try to update the cache or fail silently.
387 if (!service_records_loaded_ && !connected_ && 388 if (!service_records_loaded_ && !connected_ &&
388 properties->connected.value()) 389 properties->connected.value())
389 GetServiceRecords(base::Bind(&DoNothingServiceRecordList), 390 GetServiceRecords(base::Bind(&DoNothingServiceRecordList),
390 base::Bind(&base::DoNothing)); 391 base::Bind(&base::DoNothing));
391 392
392 paired_ = properties->paired.value(); 393 paired_ = properties->paired.value();
394 trusted_ = properties->trusted.value();
393 connected_ = properties->connected.value(); 395 connected_ = properties->connected.value();
394 } 396 }
395 } 397 }
396 398
397 void BluetoothDeviceChromeOS::OnCreateDevice( 399 void BluetoothDeviceChromeOS::OnCreateDevice(
398 const base::Closure& callback, 400 const base::Closure& callback,
399 const ConnectErrorCallback& error_callback, 401 const ConnectErrorCallback& error_callback,
400 const dbus::ObjectPath& device_path) { 402 const dbus::ObjectPath& device_path) {
401 VLOG(1) << "Connection successful: " << device_path.value(); 403 VLOG(1) << "Connection successful: " << device_path.value();
402 if (object_path_.value().empty()) { 404 if (object_path_.value().empty()) {
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 850 }
849 851
850 852
851 // static 853 // static
852 BluetoothDeviceChromeOS* BluetoothDeviceChromeOS::Create( 854 BluetoothDeviceChromeOS* BluetoothDeviceChromeOS::Create(
853 BluetoothAdapterChromeOS* adapter) { 855 BluetoothAdapterChromeOS* adapter) {
854 return new BluetoothDeviceChromeOS(adapter); 856 return new BluetoothDeviceChromeOS(adapter);
855 } 857 }
856 858
857 } // namespace chromeos 859 } // namespace chromeos
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698