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 /** | 5 /** |
| 6 * @fileoverview Oobe HID detection screen implementation. | 6 * @fileoverview Oobe HID detection screen implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 login.createScreen('HIDDetectionScreen', 'hid-detection', function() { | 9 login.createScreen('HIDDetectionScreen', 'hid-detection', function() { |
| 10 return { | 10 return { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 setDeviceBlockState_: function(blockId, state) { | 72 setDeviceBlockState_: function(blockId, state) { |
| 73 if (state == 'update') | 73 if (state == 'update') |
| 74 return; | 74 return; |
| 75 var deviceBlock = $(blockId); | 75 var deviceBlock = $(blockId); |
| 76 var states = ['searching', 'connected', 'pairing', 'paired']; | 76 var states = ['searching', 'connected', 'pairing', 'paired']; |
| 77 for (var i = 0; i < states.length; ++i) { | 77 for (var i = 0; i < states.length; ++i) { |
| 78 if (states[i] != state) | 78 if (states[i] != state) |
| 79 deviceBlock.classList.remove(states[i]); | 79 deviceBlock.classList.remove(states[i]); |
| 80 } | 80 } |
| 81 deviceBlock.classList.add(state); | 81 deviceBlock.classList.add(state); |
| 82 | |
| 83 // 'Continue' button available iff at least one device is connected, | |
| 84 if ($('hid-mouse-block').classList.contains('connected') || | |
|
ygorshenin1
2014/12/24 09:34:47
Also, it would be nice to declare a dictionary for
ygorshenin1
2014/12/24 09:34:47
I thought it would be better to rewrite predicate
merkulova
2014/12/24 13:47:46
Done.
merkulova
2014/12/24 13:47:46
Done.
| |
| 85 $('hid-mouse-block').classList.contains('paired') || | |
| 86 $('hid-keyboard-block').classList.contains('connected') || | |
| 87 $('hid-keyboard-block').classList.contains('paired')) { | |
| 88 $('hid-continue-button').disabled = false; | |
| 89 } else { | |
| 90 $('hid-continue-button').disabled = true; | |
| 91 } | |
| 82 }, | 92 }, |
| 83 | 93 |
| 84 /** | 94 /** |
| 85 * Sets state for mouse-block. | 95 * Sets state for mouse-block. |
| 86 * @param {state} one of 'searching', 'connected', 'paired'. | 96 * @param {state} one of 'searching', 'connected', 'paired'. |
| 87 */ | 97 */ |
| 88 setPointingDeviceState: function(state) { | 98 setPointingDeviceState: function(state) { |
| 89 if (state === undefined) | 99 if (state === undefined) |
| 90 return; | 100 return; |
| 91 this.setDeviceBlockState_('hid-mouse-block', state); | 101 this.setDeviceBlockState_('hid-mouse-block', state); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 announceAccessibleMessage( | 145 announceAccessibleMessage( |
| 136 data['keyboard-label'] + ' ' + data['pincode'] + ' ' + | 146 data['keyboard-label'] + ' ' + data['pincode'] + ' ' + |
| 137 loadTimeData.getString('hidDetectionBTEnterKey')); | 147 loadTimeData.getString('hidDetectionBTEnterKey')); |
| 138 } | 148 } |
| 139 } else if (state == 'update') { | 149 } else if (state == 'update') { |
| 140 if ('keysEntered' in data) { | 150 if ('keysEntered' in data) { |
| 141 this.setPincodeKeysState_(data['keysEntered']); | 151 this.setPincodeKeysState_(data['keysEntered']); |
| 142 } | 152 } |
| 143 } | 153 } |
| 144 }, | 154 }, |
| 145 | |
| 146 /** | |
|
ygorshenin1
2014/12/24 09:34:47
Why this code is removed?
merkulova
2014/12/24 13:47:46
1. Its logic is wrong: if list of connected device
| |
| 147 * Event handler that is invoked just before the screen in shown. | |
| 148 * @param {Object} data Screen init payload. | |
| 149 */ | |
| 150 onBeforeShow: function(data) { | |
| 151 $('hid-continue-button').disabled = true; | |
| 152 this.setDeviceBlockState_('hid-mouse-block', 'searching'); | |
| 153 this.setDeviceBlockState_('hid-keyboard-block', 'searching'); | |
| 154 }, | |
| 155 }; | 155 }; |
| 156 }); | 156 }); |
| OLD | NEW |