| Index: chrome/browser/resources/chromeos/login/oobe_screen_hid_detection.js
|
| diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_hid_detection.js b/chrome/browser/resources/chromeos/login/oobe_screen_hid_detection.js
|
| index 7610e2b788a4a22072d8d6b01f137c481a5b8c63..d8fe2ee6870e266836c1beaa26a9caa760f924e3 100644
|
| --- a/chrome/browser/resources/chromeos/login/oobe_screen_hid_detection.js
|
| +++ b/chrome/browser/resources/chromeos/login/oobe_screen_hid_detection.js
|
| @@ -7,11 +7,16 @@
|
| */
|
|
|
| login.createScreen('HIDDetectionScreen', 'hid-detection', function() {
|
| + var CONTEXT_KEY_KEYBOARD_STATE = 'keyboard-state';
|
| + var CONTEXT_KEY_MOUSE_STATE = 'mouse-state';
|
| + var CONTEXT_KEY_KEYBOARD_PINCODE = 'keyboard-pincode';
|
| + var CONTEXT_KEY_KEYBOARD_ENTERED_PART_PINCODE = 'entered-part-pincode';
|
| + var CONTEXT_KEY_MOUSE_DEVICE_NAME = 'mouse-device-name';
|
| + var CONTEXT_KEY_KEYBOARD_DEVICE_NAME = 'keyboard-device-name';
|
| + var CONTEXT_KEY_KEYBOARD_LABEL = 'keyboard-device-label';
|
| + var CONTEXT_KEY_CONTINUE_BUTTON_ENABLED = 'continue-button-enabled';
|
| +
|
| return {
|
| - EXTERNAL_API: [
|
| - 'setPointingDeviceState',
|
| - 'setKeyboardDeviceState',
|
| - ],
|
|
|
| /**
|
| * Enumeration of possible states during pairing. The value associated with
|
| @@ -22,18 +27,76 @@ login.createScreen('HIDDetectionScreen', 'hid-detection', function() {
|
| PAIRING: {
|
| STARTUP: 'bluetoothStartConnecting',
|
| REMOTE_PIN_CODE: 'bluetoothRemotePinCode',
|
| - REMOTE_PASSKEY: 'bluetoothRemotePasskey',
|
| CONNECT_FAILED: 'bluetoothConnectFailed',
|
| CANCELED: 'bluetoothPairingCanceled',
|
| // Pairing dismissed (succeeded or canceled).
|
| DISMISSED: 'bluetoothPairingDismissed'
|
| },
|
|
|
| - /**
|
| - * Button to move to usual OOBE flow after detection.
|
| - * @private
|
| - */
|
| - continueButton_: null,
|
| + /** @override */
|
| + decorate: function() {
|
| + var self = this;
|
| +
|
| + this.context.addObserver(
|
| + CONTEXT_KEY_MOUSE_STATE,
|
| + function(stateId) {
|
| + if (stateId === undefined)
|
| + return;
|
| + self.setDeviceBlockState_('hid-mouse-block', stateId);
|
| + }
|
| + );
|
| + this.context.addObserver(
|
| + CONTEXT_KEY_KEYBOARD_STATE,
|
| + function(stateId) {
|
| + if (stateId === undefined)
|
| + return;
|
| + self.setDeviceBlockState_('hid-keyboard-block', stateId);
|
| + if (stateId == 'paired') {
|
| + $('hid-keyboard-label-paired').textContent = self.context.get(
|
| + CONTEXT_KEY_KEYBOARD_LABEL, '');
|
| + } else if (stateId == 'pairing') {
|
| + $('hid-keyboard-label-pairing').textContent = self.context.get(
|
| + CONTEXT_KEY_KEYBOARD_LABEL, '');
|
| + } else if (stateId == 'connected') {
|
| + }
|
| + }
|
| + );
|
| + this.context.addObserver(
|
| + CONTEXT_KEY_KEYBOARD_PINCODE,
|
| + function(pincode) {
|
| + self.setPincodeKeysState_(-1);
|
| + if (!pincode) {
|
| + $('hid-keyboard-pincode').classList.remove('show-pincode');
|
| + return;
|
| + }
|
| + if (self.context.get(CONTEXT_KEY_KEYBOARD_STATE, '') != 'pairing')
|
| + return;
|
| + $('hid-keyboard-pincode').classList.add('show-pincode');
|
| + for (var i = 0, len = pincode.length; i < len; i++) {
|
| + var pincodeSymbol = $('hid-keyboard-pincode-sym-' + (i + 1));
|
| + pincodeSymbol.textContent = pincode[i];
|
| + }
|
| + announceAccessibleMessage(
|
| + self.context.get(CONTEXT_KEY_KEYBOARD_LABEL, '') + ' ' + pincode +
|
| + ' ' + loadTimeData.getString('hidDetectionBTEnterKey'));
|
| + }
|
| + );
|
| + this.context.addObserver(
|
| + CONTEXT_KEY_KEYBOARD_ENTERED_PART_PINCODE,
|
| + function(entered_part) {
|
| + if (self.context.get(CONTEXT_KEY_KEYBOARD_STATE, '') != 'pairing')
|
| + return;
|
| + if (entered_part >= 0)
|
| + self.setPincodeKeysState_(entered_part);
|
| + }
|
| + );
|
| + this.context.addObserver(
|
| + CONTEXT_KEY_CONTINUE_BUTTON_ENABLED,
|
| + function(enabled) {
|
| + $('hid-continue-button').disabled = !enabled;
|
| + }
|
| + );
|
| + },
|
|
|
| /**
|
| * Buttons in oobe wizard's button strip.
|
| @@ -50,7 +113,6 @@ login.createScreen('HIDDetectionScreen', 'hid-detection', function() {
|
| e.stopPropagation();
|
| });
|
| buttons.push(continueButton);
|
| - this.continueButton_ = continueButton;
|
|
|
| return buttons;
|
| },
|
| @@ -59,7 +121,7 @@ login.createScreen('HIDDetectionScreen', 'hid-detection', function() {
|
| * Returns a control which should receive an initial focus.
|
| */
|
| get defaultControl() {
|
| - return this.continueButton_;
|
| + return $('hid-continue-button');
|
| },
|
|
|
| /**
|
| @@ -113,37 +175,6 @@ login.createScreen('HIDDetectionScreen', 'hid-detection', function() {
|
| },
|
|
|
| /**
|
| - * Sets state for keyboard-block.
|
| - * @param {data} dict with parameters.
|
| - */
|
| - setKeyboardDeviceState: function(data) {
|
| - if (data === undefined || !('state' in data))
|
| - return;
|
| - var state = data['state'];
|
| - this.setDeviceBlockState_('hid-keyboard-block', state);
|
| - if (state == 'paired')
|
| - $('hid-keyboard-label-paired').textContent = data['keyboard-label'];
|
| - else if (state == 'pairing') {
|
| - $('hid-keyboard-label-pairing').textContent = data['keyboard-label'];
|
| - if (data['pairing-state'] == this.PAIRING.REMOTE_PIN_CODE ||
|
| - data['pairing-state'] == this.PAIRING.REMOTE_PASSKEY) {
|
| - this.setPincodeKeysState_(-1);
|
| - for (var i = 0, len = data['pincode'].length; i < len; i++) {
|
| - var pincodeSymbol = $('hid-keyboard-pincode-sym-' + (i + 1));
|
| - pincodeSymbol.textContent = data['pincode'][i];
|
| - }
|
| - announceAccessibleMessage(
|
| - data['keyboard-label'] + ' ' + data['pincode'] + ' ' +
|
| - loadTimeData.getString('hidDetectionBTEnterKey'));
|
| - }
|
| - } else if (state == 'update') {
|
| - if ('keysEntered' in data) {
|
| - this.setPincodeKeysState_(data['keysEntered']);
|
| - }
|
| - }
|
| - },
|
| -
|
| - /**
|
| * Event handler that is invoked just before the screen in shown.
|
| * @param {Object} data Screen init payload.
|
| */
|
|
|