| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 void BluetoothPrivateConnectFunction::OnSuccessCallback() { | 509 void BluetoothPrivateConnectFunction::OnSuccessCallback() { |
| 510 results_ = bt_private::Connect::Results::Create( | 510 results_ = bt_private::Connect::Results::Create( |
| 511 bt_private::CONNECT_RESULT_TYPE_SUCCESS); | 511 bt_private::CONNECT_RESULT_TYPE_SUCCESS); |
| 512 SendResponse(true); | 512 SendResponse(true); |
| 513 } | 513 } |
| 514 | 514 |
| 515 void BluetoothPrivateConnectFunction::OnErrorCallback( | 515 void BluetoothPrivateConnectFunction::OnErrorCallback( |
| 516 device::BluetoothDevice::ConnectErrorCode error) { | 516 device::BluetoothDevice::ConnectErrorCode error) { |
| 517 bt_private::ConnectResultType result = bt_private::CONNECT_RESULT_TYPE_NONE; | 517 bt_private::ConnectResultType result = bt_private::CONNECT_RESULT_TYPE_NONE; |
| 518 switch (error) { | 518 switch (error) { |
| 519 case device::BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID: | |
| 520 result = bt_private::CONNECT_RESULT_TYPE_ATTRIBUTELENGTHINVALID; | |
| 521 break; | |
| 522 case device::BluetoothDevice::ERROR_AUTH_CANCELED: | 519 case device::BluetoothDevice::ERROR_AUTH_CANCELED: |
| 523 result = bt_private::CONNECT_RESULT_TYPE_AUTHCANCELED; | 520 result = bt_private::CONNECT_RESULT_TYPE_AUTHCANCELED; |
| 524 break; | 521 break; |
| 525 case device::BluetoothDevice::ERROR_AUTH_FAILED: | 522 case device::BluetoothDevice::ERROR_AUTH_FAILED: |
| 526 result = bt_private::CONNECT_RESULT_TYPE_AUTHFAILED; | 523 result = bt_private::CONNECT_RESULT_TYPE_AUTHFAILED; |
| 527 break; | 524 break; |
| 528 case device::BluetoothDevice::ERROR_AUTH_REJECTED: | 525 case device::BluetoothDevice::ERROR_AUTH_REJECTED: |
| 529 result = bt_private::CONNECT_RESULT_TYPE_AUTHREJECTED; | 526 result = bt_private::CONNECT_RESULT_TYPE_AUTHREJECTED; |
| 530 break; | 527 break; |
| 531 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: | 528 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: |
| 532 result = bt_private::CONNECT_RESULT_TYPE_AUTHTIMEOUT; | 529 result = bt_private::CONNECT_RESULT_TYPE_AUTHTIMEOUT; |
| 533 break; | 530 break; |
| 534 case device::BluetoothDevice::ERROR_CONNECTION_CONGESTED: | |
| 535 result = bt_private::CONNECT_RESULT_TYPE_CONNECTIONCONGESTED; | |
| 536 break; | |
| 537 case device::BluetoothDevice::ERROR_FAILED: | 531 case device::BluetoothDevice::ERROR_FAILED: |
| 538 result = bt_private::CONNECT_RESULT_TYPE_FAILED; | 532 result = bt_private::CONNECT_RESULT_TYPE_FAILED; |
| 539 break; | 533 break; |
| 540 case device::BluetoothDevice::ERROR_INPROGRESS: | 534 case device::BluetoothDevice::ERROR_INPROGRESS: |
| 541 result = bt_private::CONNECT_RESULT_TYPE_INPROGRESS; | 535 result = bt_private::CONNECT_RESULT_TYPE_INPROGRESS; |
| 542 break; | 536 break; |
| 543 case device::BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION: | |
| 544 result = bt_private::CONNECT_RESULT_TYPE_INSUFFICIENTENCRYPTION; | |
| 545 break; | |
| 546 case device::BluetoothDevice::ERROR_OFFSET_INVALID: | |
| 547 result = bt_private::CONNECT_RESULT_TYPE_OFFSETINVALID; | |
| 548 break; | |
| 549 case device::BluetoothDevice::ERROR_READ_NOT_PERMITTED: | |
| 550 result = bt_private::CONNECT_RESULT_TYPE_READNOTPERMITTED; | |
| 551 break; | |
| 552 case device::BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED: | |
| 553 result = bt_private::CONNECT_RESULT_TYPE_REQUESTNOTSUPPORTED; | |
| 554 break; | |
| 555 case device::BluetoothDevice::ERROR_UNKNOWN: | 537 case device::BluetoothDevice::ERROR_UNKNOWN: |
| 556 result = bt_private::CONNECT_RESULT_TYPE_UNKNOWNERROR; | 538 result = bt_private::CONNECT_RESULT_TYPE_UNKNOWNERROR; |
| 557 break; | 539 break; |
| 558 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: | 540 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: |
| 559 result = bt_private::CONNECT_RESULT_TYPE_UNSUPPORTEDDEVICE; | 541 result = bt_private::CONNECT_RESULT_TYPE_UNSUPPORTEDDEVICE; |
| 560 break; | 542 break; |
| 561 case device::BluetoothDevice::ERROR_WRITE_NOT_PERMITTED: | |
| 562 result = bt_private::CONNECT_RESULT_TYPE_WRITENOTPERMITTED; | |
| 563 break; | |
| 564 case device::BluetoothDevice::NUM_CONNECT_ERROR_CODES: | 543 case device::BluetoothDevice::NUM_CONNECT_ERROR_CODES: |
| 565 NOTREACHED(); | 544 NOTREACHED(); |
| 566 break; | 545 break; |
| 567 } | 546 } |
| 568 // Set the result type and respond with true (success). | 547 // Set the result type and respond with true (success). |
| 569 results_ = bt_private::Connect::Results::Create(result); | 548 results_ = bt_private::Connect::Results::Create(result); |
| 570 SendResponse(true); | 549 SendResponse(true); |
| 571 } | 550 } |
| 572 | 551 |
| 573 //////////////////////////////////////////////////////////////////////////////// | 552 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 device::BluetoothDevice::ConnectErrorCode error) { | 596 device::BluetoothDevice::ConnectErrorCode error) { |
| 618 SetError(kPairingFailed); | 597 SetError(kPairingFailed); |
| 619 SendResponse(false); | 598 SendResponse(false); |
| 620 } | 599 } |
| 621 | 600 |
| 622 //////////////////////////////////////////////////////////////////////////////// | 601 //////////////////////////////////////////////////////////////////////////////// |
| 623 | 602 |
| 624 } // namespace api | 603 } // namespace api |
| 625 | 604 |
| 626 } // namespace extensions | 605 } // namespace extensions |
| OLD | NEW |