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 var CONTEXT_KEY_KEYBOARD_STATE = 'keyboard-state'; | 10 var CONTEXT_KEY_KEYBOARD_STATE = 'keyboard-state'; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 * Sets a device-block css class to reflect device state of searching, | 162 * Sets a device-block css class to reflect device state of searching, |
163 * connected, pairing or paired (for BT devices). | 163 * connected, pairing or paired (for BT devices). |
164 * @param {blockId} id one of keys of this.BLOCK dict. | 164 * @param {blockId} id one of keys of this.BLOCK dict. |
165 * @param {state} one of keys of this.CONNECTION dict. | 165 * @param {state} one of keys of this.CONNECTION dict. |
166 * @private | 166 * @private |
167 */ | 167 */ |
168 setDeviceBlockState_: function(blockId, state) { | 168 setDeviceBlockState_: function(blockId, state) { |
169 if (state == 'update') | 169 if (state == 'update') |
170 return; | 170 return; |
171 var deviceBlock = $(blockId); | 171 var deviceBlock = $(blockId); |
172 for (var stateCase in this.CONNECTION) | 172 for (var key in this.CONNECTION) { |
173 var stateCase = this.CONNECTION[key]; | |
173 deviceBlock.classList.toggle(stateCase, stateCase == state); | 174 deviceBlock.classList.toggle(stateCase, stateCase == state); |
175 } | |
174 | 176 |
175 // 'Continue' button available iff at least one device is connected, | 177 // 'Continue' button available iff at least one device is connected, |
176 if ((blockId in this.BLOCK) && | 178 var keyboardState = this.context.get(CONTEXT_KEY_KEYBOARD_STATE, ''); |
Nikita (slow)
2015/02/26 12:10:08
As discussed, please move this login to C++ side.
| |
177 (state == this.CONNECTION.CONNECTED || | 179 var mouseState = this.context.get(CONTEXT_KEY_MOUSE_STATE, ''); |
178 state == this.CONNECTION.PAIRED)) { | 180 if (keyboardState == this.CONNECTION.CONNECTED || |
181 keyboardState == this.CONNECTION.PAIRED || | |
182 mouseState == this.CONNECTION.CONNECTED || | |
183 mouseState == this.CONNECTION.PAIRED) { | |
179 $('hid-continue-button').disabled = false; | 184 $('hid-continue-button').disabled = false; |
180 } else { | 185 } else { |
181 $('hid-continue-button').disabled = true; | 186 $('hid-continue-button').disabled = true; |
182 } | 187 } |
183 }, | 188 }, |
184 | 189 |
185 /** | 190 /** |
186 * Sets state for mouse-block. | 191 * Sets state for mouse-block. |
187 * @param {state} one of keys of this.CONNECTION dict. | 192 * @param {state} one of keys of this.CONNECTION dict. |
188 */ | 193 */ |
(...skipping 25 matching lines...) Expand all Loading... | |
214 * Event handler that is invoked just before the screen in shown. | 219 * Event handler that is invoked just before the screen in shown. |
215 * @param {Object} data Screen init payload. | 220 * @param {Object} data Screen init payload. |
216 */ | 221 */ |
217 onBeforeShow: function(data) { | 222 onBeforeShow: function(data) { |
218 this.setDeviceBlockState_('hid-mouse-block', this.CONNECTION.SEARCHING); | 223 this.setDeviceBlockState_('hid-mouse-block', this.CONNECTION.SEARCHING); |
219 this.setDeviceBlockState_('hid-keyboard-block', | 224 this.setDeviceBlockState_('hid-keyboard-block', |
220 this.CONNECTION.SEARCHING); | 225 this.CONNECTION.SEARCHING); |
221 }, | 226 }, |
222 }; | 227 }; |
223 }); | 228 }); |
OLD | NEW |