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); |
174 | |
175 // 'Continue' button available iff at least one device is connected, | |
176 if ((blockId in this.BLOCK) && | |
177 (state == this.CONNECTION.CONNECTED || | |
178 state == this.CONNECTION.PAIRED)) { | |
179 $('hid-continue-button').disabled = false; | |
180 } else { | |
181 $('hid-continue-button').disabled = true; | |
182 } | 175 } |
183 }, | 176 }, |
184 | 177 |
185 /** | 178 /** |
186 * Sets state for mouse-block. | 179 * Sets state for mouse-block. |
187 * @param {state} one of keys of this.CONNECTION dict. | 180 * @param {state} one of keys of this.CONNECTION dict. |
188 */ | 181 */ |
189 setPointingDeviceState: function(state) { | 182 setPointingDeviceState: function(state) { |
190 if (state === undefined) | 183 if (state === undefined) |
191 return; | 184 return; |
(...skipping 22 matching lines...) Expand all Loading... |
214 * Event handler that is invoked just before the screen in shown. | 207 * Event handler that is invoked just before the screen in shown. |
215 * @param {Object} data Screen init payload. | 208 * @param {Object} data Screen init payload. |
216 */ | 209 */ |
217 onBeforeShow: function(data) { | 210 onBeforeShow: function(data) { |
218 this.setDeviceBlockState_('hid-mouse-block', this.CONNECTION.SEARCHING); | 211 this.setDeviceBlockState_('hid-mouse-block', this.CONNECTION.SEARCHING); |
219 this.setDeviceBlockState_('hid-keyboard-block', | 212 this.setDeviceBlockState_('hid-keyboard-block', |
220 this.CONNECTION.SEARCHING); | 213 this.CONNECTION.SEARCHING); |
221 }, | 214 }, |
222 }; | 215 }; |
223 }); | 216 }); |
OLD | NEW |