Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/bluetooth/bluetooth_private_api.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_private_api.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "device/bluetooth/bluetooth_adapter.h" | 10 #include "device/bluetooth/bluetooth_adapter.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 break; | 528 break; |
| 529 case device::BluetoothDevice::ERROR_AUTH_REJECTED: | 529 case device::BluetoothDevice::ERROR_AUTH_REJECTED: |
| 530 result = bt_private::CONNECT_RESULT_TYPE_AUTHREJECTED; | 530 result = bt_private::CONNECT_RESULT_TYPE_AUTHREJECTED; |
| 531 break; | 531 break; |
| 532 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: | 532 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: |
| 533 result = bt_private::CONNECT_RESULT_TYPE_AUTHTIMEOUT; | 533 result = bt_private::CONNECT_RESULT_TYPE_AUTHTIMEOUT; |
| 534 break; | 534 break; |
| 535 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: | 535 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: |
| 536 result = bt_private::CONNECT_RESULT_TYPE_UNSUPPORTEDDEVICE; | 536 result = bt_private::CONNECT_RESULT_TYPE_UNSUPPORTEDDEVICE; |
| 537 break; | 537 break; |
| 538 case device::BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID: | |
| 539 result = bt_private::CONNECT_RESULT_TYPE_ATTRIBUTELENGTHINVALID; | |
| 540 break; | |
| 541 case device::BluetoothDevice::ERROR_CONNECTION_CONGESTED: | |
| 542 result = bt_private::CONNECT_RESULT_TYPE_CONNECTIONCONGESTED; | |
| 543 break; | |
| 544 case device::BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION: | |
| 545 result = bt_private::CONNECT_RESULT_TYPE_INSUFFICIENTENCRYPTION; | |
| 546 break; | |
| 547 case device::BluetoothDevice::ERROR_OFFSET_INVALID: | |
| 548 result = bt_private::CONNECT_RESULT_TYPE_OFFSETINVALID; | |
| 549 break; | |
| 550 case device::BluetoothDevice::ERROR_READ_FAILED: | |
| 551 result = bt_private::CONNECT_RESULT_TYPE_READFAILED; | |
| 552 break; | |
| 553 case device::BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED: | |
| 554 result = bt_private::CONNECT_RESULT_TYPE_REQUESTNOTSUPPORTED; | |
| 555 break; | |
| 556 case device::BluetoothDevice::ERROR_WRITE_FAILED: | |
|
Kai Jiang
2015/11/29 10:40:51
ERROR_{READ, WRITE}_NOT_PERMITTED
| |
| 557 result = bt_private::CONNECT_RESULT_TYPE_WRITEFAILED; | |
| 558 break; | |
|
Kai Jiang
2015/11/29 10:40:51
sorted above.
| |
| 538 } | 559 } |
| 539 // Set the result type and respond with true (success). | 560 // Set the result type and respond with true (success). |
| 540 results_ = bt_private::Connect::Results::Create(result); | 561 results_ = bt_private::Connect::Results::Create(result); |
| 541 SendResponse(true); | 562 SendResponse(true); |
| 542 } | 563 } |
| 543 | 564 |
| 544 //////////////////////////////////////////////////////////////////////////////// | 565 //////////////////////////////////////////////////////////////////////////////// |
| 545 | 566 |
| 546 BluetoothPrivatePairFunction::BluetoothPrivatePairFunction() {} | 567 BluetoothPrivatePairFunction::BluetoothPrivatePairFunction() {} |
| 547 | 568 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 device::BluetoothDevice::ConnectErrorCode error) { | 609 device::BluetoothDevice::ConnectErrorCode error) { |
| 589 SetError(kPairingFailed); | 610 SetError(kPairingFailed); |
| 590 SendResponse(false); | 611 SendResponse(false); |
| 591 } | 612 } |
| 592 | 613 |
| 593 //////////////////////////////////////////////////////////////////////////////// | 614 //////////////////////////////////////////////////////////////////////////////// |
| 594 | 615 |
| 595 } // namespace api | 616 } // namespace api |
| 596 | 617 |
| 597 } // namespace extensions | 618 } // namespace extensions |
| OLD | NEW |