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_socket_chromeos.h" | 5 #include "device/bluetooth/bluetooth_socket_chromeos.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 if (adapter_.get()) { | 86 if (adapter_.get()) { |
87 adapter_->RemoveObserver(this); | 87 adapter_->RemoveObserver(this); |
88 adapter_ = NULL; | 88 adapter_ = NULL; |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void BluetoothSocketChromeOS::Connect( | 92 void BluetoothSocketChromeOS::Connect( |
93 const BluetoothDeviceChromeOS* device, | 93 const BluetoothDeviceChromeOS* device, |
94 const BluetoothUUID& uuid, | 94 const BluetoothUUID& uuid, |
| 95 SecurityLevel security_level, |
95 const base::Closure& success_callback, | 96 const base::Closure& success_callback, |
96 const ErrorCompletionCallback& error_callback) { | 97 const ErrorCompletionCallback& error_callback) { |
97 DCHECK(ui_task_runner()->RunsTasksOnCurrentThread()); | 98 DCHECK(ui_task_runner()->RunsTasksOnCurrentThread()); |
98 DCHECK(object_path_.value().empty()); | 99 DCHECK(object_path_.value().empty()); |
99 DCHECK(!profile_.get()); | 100 DCHECK(!profile_.get()); |
100 | 101 |
101 if (!uuid.IsValid()) { | 102 if (!uuid.IsValid()) { |
102 error_callback.Run(kInvalidUUID); | 103 error_callback.Run(kInvalidUUID); |
103 return; | 104 return; |
104 } | 105 } |
105 | 106 |
106 device_address_ = device->GetAddress(); | 107 device_address_ = device->GetAddress(); |
107 device_path_ = device->object_path(); | 108 device_path_ = device->object_path(); |
108 uuid_ = uuid; | 109 uuid_ = uuid; |
109 options_.reset(new BluetoothProfileManagerClient::Options()); | 110 options_.reset(new BluetoothProfileManagerClient::Options()); |
| 111 if (security_level == SECURITY_LEVEL_LOW) |
| 112 options_->require_authentication.reset(new bool(false)); |
110 | 113 |
111 RegisterProfile(success_callback, error_callback); | 114 RegisterProfile(success_callback, error_callback); |
112 } | 115 } |
113 | 116 |
114 void BluetoothSocketChromeOS::Listen( | 117 void BluetoothSocketChromeOS::Listen( |
115 scoped_refptr<BluetoothAdapter> adapter, | 118 scoped_refptr<BluetoothAdapter> adapter, |
116 SocketType socket_type, | 119 SocketType socket_type, |
117 const BluetoothUUID& uuid, | 120 const BluetoothUUID& uuid, |
118 const BluetoothAdapter::ServiceOptions& service_options, | 121 const BluetoothAdapter::ServiceOptions& service_options, |
119 const base::Closure& success_callback, | 122 const base::Closure& success_callback, |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // It's okay if the profile doesn't exist, it means we haven't registered it | 584 // It's okay if the profile doesn't exist, it means we haven't registered it |
582 // yet. | 585 // yet. |
583 if (error_name == bluetooth_profile_manager::kErrorDoesNotExist) | 586 if (error_name == bluetooth_profile_manager::kErrorDoesNotExist) |
584 return; | 587 return; |
585 | 588 |
586 LOG(WARNING) << object_path_.value() << ": Failed to unregister profile: " | 589 LOG(WARNING) << object_path_.value() << ": Failed to unregister profile: " |
587 << error_name << ": " << error_message; | 590 << error_name << ": " << error_message; |
588 } | 591 } |
589 | 592 |
590 } // namespace chromeos | 593 } // namespace chromeos |
OLD | NEW |