Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 /** | 5 /** |
| 6 * Enumeration of possible states during pairing. The value associated with | 6 * Enumeration of possible states during pairing. The value associated with |
| 7 * each state maps to a localized string in the global variable | 7 * each state maps to a localized string in the global variable |
| 8 * |loadTimeData|. | 8 * |loadTimeData|. |
| 9 * @enum {string} | 9 * @enum {string} |
| 10 */ | 10 */ |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 var message; | 514 var message; |
| 515 if (chrome.runtime.lastError) { | 515 if (chrome.runtime.lastError) { |
| 516 var errorMessage = chrome.runtime.lastError.message; | 516 var errorMessage = chrome.runtime.lastError.message; |
| 517 if (errorMessage != 'Connect failed') { | 517 if (errorMessage != 'Connect failed') { |
| 518 console.error('bluetoothPrivate.connect: Unexpected error for: ' + | 518 console.error('bluetoothPrivate.connect: Unexpected error for: ' + |
| 519 address + ': ' + errorMessage); | 519 address + ': ' + errorMessage); |
| 520 } | 520 } |
| 521 } | 521 } |
| 522 switch (result) { | 522 switch (result) { |
| 523 case chrome.bluetoothPrivate.ConnectResultType.SUCCESS: | 523 case chrome.bluetoothPrivate.ConnectResultType.SUCCESS: |
| 524 case chrome.bluetoothPrivate.ConnectResultType.ALREADY_CONNECTED: | 524 case chrome.bluetoothPrivate.ConnectResultType.ALREADY_CONNECTED: |
|
scheib
2015/11/26 00:02:51
Sort list alphabetically.
Kai Jiang
2015/11/29 10:40:51
Done.
| |
| 525 BluetoothPairing.dismissDialog(); | 525 BluetoothPairing.dismissDialog(); |
| 526 return; | 526 return; |
| 527 case chrome.bluetoothPrivate.ConnectResultType.UNKNOWN_ERROR: | 527 case chrome.bluetoothPrivate.ConnectResultType.UNKNOWN_ERROR: |
| 528 message = 'bluetoothConnectUnknownError'; | 528 message = 'bluetoothConnectUnknownError'; |
| 529 break; | 529 break; |
| 530 case chrome.bluetoothPrivate.ConnectResultType.IN_PROGRESS: | 530 case chrome.bluetoothPrivate.ConnectResultType.IN_PROGRESS: |
| 531 message = 'bluetoothConnectInProgress'; | 531 message = 'bluetoothConnectInProgress'; |
| 532 break; | 532 break; |
| 533 case chrome.bluetoothPrivate.ConnectResultType.FAILED: | 533 case chrome.bluetoothPrivate.ConnectResultType.FAILED: |
| 534 message = 'bluetoothConnectFailed'; | 534 message = 'bluetoothConnectFailed'; |
| 535 break; | 535 break; |
| 536 case chrome.bluetoothPrivate.ConnectResultType.AUTH_FAILED: | 536 case chrome.bluetoothPrivate.ConnectResultType.AUTH_FAILED: |
| 537 message = 'bluetoothConnectAuthFailed'; | 537 message = 'bluetoothConnectAuthFailed'; |
| 538 break; | 538 break; |
| 539 case chrome.bluetoothPrivate.ConnectResultType.AUTH_CANCELED: | 539 case chrome.bluetoothPrivate.ConnectResultType.AUTH_CANCELED: |
| 540 message = 'bluetoothConnectAuthCanceled'; | 540 message = 'bluetoothConnectAuthCanceled'; |
| 541 break; | 541 break; |
| 542 case chrome.bluetoothPrivate.ConnectResultType.AUTH_REJECTED: | 542 case chrome.bluetoothPrivate.ConnectResultType.AUTH_REJECTED: |
| 543 message = 'bluetoothConnectAuthRejected'; | 543 message = 'bluetoothConnectAuthRejected'; |
| 544 break; | 544 break; |
| 545 case chrome.bluetoothPrivate.ConnectResultType.AUTH_TIMEOUT: | 545 case chrome.bluetoothPrivate.ConnectResultType.AUTH_TIMEOUT: |
| 546 message = 'bluetoothConnectAuthTimeout'; | 546 message = 'bluetoothConnectAuthTimeout'; |
| 547 break; | 547 break; |
| 548 case chrome.bluetoothPrivate.ConnectResultType.UNSUPPORTED_DEVICE: | 548 case chrome.bluetoothPrivate.ConnectResultType.UNSUPPORTED_DEVICE: |
| 549 message = 'bluetoothConnectUnsupportedDevice'; | 549 message = 'bluetoothConnectUnsupportedDevice'; |
| 550 break; | 550 break; |
| 551 case chrome.bluetoothPrivate.ConnectResultType.ATTRIBUTE_LENGTH_INVALID: | |
|
scheib
2015/11/26 00:02:51
We should check with [OWNERS] of this UI and propo
| |
| 552 message = 'bluetoothConnectAttributeLengthInvalid'; | |
| 553 break; | |
| 554 case chrome.bluetoothPrivate.ConnectResultType.CONNECTION_CONGESTED: | |
| 555 message = 'bluetoothConnectConnectionCongested'; | |
| 556 break; | |
| 557 case chrome.bluetoothPrivate.ConnctResultType.INSUFFICIENT_ENCRYPTION: | |
| 558 message = 'bluetoothConnectInsufficientEncryption'; | |
| 559 break; | |
| 560 case chrome.bluetoothPrivate.ConnctResultType.OFFSET_INVALID: | |
| 561 message = 'bluetoothConnectOffsetInvalid'; | |
| 562 break; | |
| 563 case chrome.bluetoothPrivate.ConnctResultType.READ_FAILED: | |
| 564 message = 'bluetoothConnectReadFailed'; | |
|
scheib
2015/11/26 00:02:51
Enum and string should use 'permitted' instead of
| |
| 565 break; | |
| 566 case chrome.bluetoothPrivate.ConnctResultType.REQUEST_NOT_SUPPORTED: | |
| 567 message = 'bluetoothConnectRequestNotSupported'; | |
| 568 break; | |
| 569 case chrome.bluetoothPrivate.ConnctResultType.WRITE_FAILED: | |
| 570 message = 'bluetoothConnectWriteFailed'; | |
|
scheib
2015/11/26 00:02:51
Enum and string should use 'permitted' instead of
Kai Jiang
2015/11/29 10:40:51
Done.
| |
| 571 break; | |
| 551 } | 572 } |
| 552 if (message) | 573 if (message) |
| 553 BluetoothPairing.showMessage({message: message, address: address}); | 574 BluetoothPairing.showMessage({message: message, address: address}); |
| 554 }; | 575 }; |
| 555 | 576 |
| 556 /** | 577 /** |
| 557 * Closes the Bluetooth pairing dialog. | 578 * Closes the Bluetooth pairing dialog. |
| 558 */ | 579 */ |
| 559 BluetoothPairing.dismissDialog = function() { | 580 BluetoothPairing.dismissDialog = function() { |
| 560 var overlay = PageManager.getTopmostVisiblePage(); | 581 var overlay = PageManager.getTopmostVisiblePage(); |
| 561 var dialog = BluetoothPairing.getInstance(); | 582 var dialog = BluetoothPairing.getInstance(); |
| 562 if (overlay == dialog && dialog.dismissible_) { | 583 if (overlay == dialog && dialog.dismissible_) { |
| 563 if (dialog.event_) | 584 if (dialog.event_) |
| 564 dialog.event_.pairing = BluetoothPairingEventType.DISMISSED; | 585 dialog.event_.pairing = BluetoothPairingEventType.DISMISSED; |
| 565 PageManager.closeOverlay(); | 586 PageManager.closeOverlay(); |
| 566 } | 587 } |
| 567 }; | 588 }; |
| 568 | 589 |
| 569 // Export | 590 // Export |
| 570 return { | 591 return { |
| 571 BluetoothPairing: BluetoothPairing | 592 BluetoothPairing: BluetoothPairing |
| 572 }; | 593 }; |
| 573 }); | 594 }); |
| OLD | NEW |