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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_private_api.cc

Issue 1464443002: bluetooth: android: Add BluetoothDevice::ConnectErrorCode enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VI Created 4 years, 11 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 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 void BluetoothPrivateConnectFunction::OnSuccessCallback() { 508 void BluetoothPrivateConnectFunction::OnSuccessCallback() {
509 results_ = bt_private::Connect::Results::Create( 509 results_ = bt_private::Connect::Results::Create(
510 bt_private::CONNECT_RESULT_TYPE_SUCCESS); 510 bt_private::CONNECT_RESULT_TYPE_SUCCESS);
511 SendResponse(true); 511 SendResponse(true);
512 } 512 }
513 513
514 void BluetoothPrivateConnectFunction::OnErrorCallback( 514 void BluetoothPrivateConnectFunction::OnErrorCallback(
515 device::BluetoothDevice::ConnectErrorCode error) { 515 device::BluetoothDevice::ConnectErrorCode error) {
516 bt_private::ConnectResultType result = bt_private::CONNECT_RESULT_TYPE_NONE; 516 bt_private::ConnectResultType result = bt_private::CONNECT_RESULT_TYPE_NONE;
517 switch (error) { 517 switch (error) {
518 case device::BluetoothDevice::ERROR_UNKNOWN: 518 case device::BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID:
519 result = bt_private::CONNECT_RESULT_TYPE_UNKNOWNERROR; 519 result = bt_private::CONNECT_RESULT_TYPE_ATTRIBUTELENGTHINVALID;
520 break; 520 break;
521 case device::BluetoothDevice::ERROR_INPROGRESS: 521 case device::BluetoothDevice::ERROR_AUTH_CANCELED:
522 result = bt_private::CONNECT_RESULT_TYPE_INPROGRESS; 522 result = bt_private::CONNECT_RESULT_TYPE_AUTHCANCELED;
523 break;
524 case device::BluetoothDevice::ERROR_FAILED:
525 result = bt_private::CONNECT_RESULT_TYPE_FAILED;
526 break; 523 break;
527 case device::BluetoothDevice::ERROR_AUTH_FAILED: 524 case device::BluetoothDevice::ERROR_AUTH_FAILED:
528 result = bt_private::CONNECT_RESULT_TYPE_AUTHFAILED; 525 result = bt_private::CONNECT_RESULT_TYPE_AUTHFAILED;
529 break; 526 break;
530 case device::BluetoothDevice::ERROR_AUTH_CANCELED:
531 result = bt_private::CONNECT_RESULT_TYPE_AUTHCANCELED;
532 break;
533 case device::BluetoothDevice::ERROR_AUTH_REJECTED: 527 case device::BluetoothDevice::ERROR_AUTH_REJECTED:
534 result = bt_private::CONNECT_RESULT_TYPE_AUTHREJECTED; 528 result = bt_private::CONNECT_RESULT_TYPE_AUTHREJECTED;
535 break; 529 break;
536 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: 530 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT:
537 result = bt_private::CONNECT_RESULT_TYPE_AUTHTIMEOUT; 531 result = bt_private::CONNECT_RESULT_TYPE_AUTHTIMEOUT;
538 break; 532 break;
533 case device::BluetoothDevice::ERROR_CONNECTION_CONGESTED:
534 result = bt_private::CONNECT_RESULT_TYPE_CONNECTIONCONGESTED;
535 break;
536 case device::BluetoothDevice::ERROR_FAILED:
537 result = bt_private::CONNECT_RESULT_TYPE_FAILED;
538 break;
539 case device::BluetoothDevice::ERROR_INPROGRESS:
540 result = bt_private::CONNECT_RESULT_TYPE_INPROGRESS;
541 break;
542 case device::BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION:
543 result = bt_private::CONNECT_RESULT_TYPE_INSUFFICIENTENCRYPTION;
544 break;
545 case device::BluetoothDevice::ERROR_OFFSET_INVALID:
546 result = bt_private::CONNECT_RESULT_TYPE_OFFSETINVALID;
547 break;
548 case device::BluetoothDevice::ERROR_READ_NOT_PERMITTED:
549 result = bt_private::CONNECT_RESULT_TYPE_READNOTPERMITTED;
550 break;
551 case device::BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED:
552 result = bt_private::CONNECT_RESULT_TYPE_REQUESTNOTSUPPORTED;
553 break;
554 case device::BluetoothDevice::ERROR_UNKNOWN:
555 result = bt_private::CONNECT_RESULT_TYPE_UNKNOWNERROR;
556 break;
539 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: 557 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE:
540 result = bt_private::CONNECT_RESULT_TYPE_UNSUPPORTEDDEVICE; 558 result = bt_private::CONNECT_RESULT_TYPE_UNSUPPORTEDDEVICE;
541 break; 559 break;
560 case device::BluetoothDevice::ERROR_WRITE_NOT_PERMITTED:
561 result = bt_private::CONNECT_RESULT_TYPE_WRITENOTPERMITTED;
562 break;
563 case device::BluetoothDevice::NUM_CONNECT_ERROR_CODES:
564 NOTREACHED();
565 break;
542 } 566 }
543 // Set the result type and respond with true (success). 567 // Set the result type and respond with true (success).
544 results_ = bt_private::Connect::Results::Create(result); 568 results_ = bt_private::Connect::Results::Create(result);
545 SendResponse(true); 569 SendResponse(true);
546 } 570 }
547 571
548 //////////////////////////////////////////////////////////////////////////////// 572 ////////////////////////////////////////////////////////////////////////////////
549 573
550 BluetoothPrivatePairFunction::BluetoothPrivatePairFunction() {} 574 BluetoothPrivatePairFunction::BluetoothPrivatePairFunction() {}
551 575
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 device::BluetoothDevice::ConnectErrorCode error) { 616 device::BluetoothDevice::ConnectErrorCode error) {
593 SetError(kPairingFailed); 617 SetError(kPairingFailed);
594 SendResponse(false); 618 SendResponse(false);
595 } 619 }
596 620
597 //////////////////////////////////////////////////////////////////////////////// 621 ////////////////////////////////////////////////////////////////////////////////
598 622
599 } // namespace api 623 } // namespace api
600 624
601 } // namespace extensions 625 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698