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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 /** | 9 /** |
10 * Enumeration of possible states during pairing. The value associated with | 10 * Enumeration of possible states during pairing. The value associated with |
11 * each state maps to a localized string in the global variable | 11 * each state maps to a localized string in the global variable |
12 * |loadTimeData|. | 12 * |loadTimeData|. |
13 * @enum {string} | 13 * @enum {string} |
14 */ | 14 */ |
15 var PAIRING = { | 15 var PAIRING = { |
16 STARTUP: 'bluetoothStartConnecting', | 16 STARTUP: 'bluetoothStartConnecting', |
17 ENTER_PIN_CODE: 'bluetoothEnterPinCode', | 17 ENTER_PIN_CODE: 'bluetoothEnterPinCode', |
18 ENTER_PASSKEY: 'bluetoothEnterPasskey', | 18 ENTER_PASSKEY: 'bluetoothEnterPasskey', |
19 REMOTE_PIN_CODE: 'bluetoothRemotePinCode', | 19 REMOTE_PIN_CODE: 'bluetoothRemotePinCode', |
20 REMOTE_PASSKEY: 'bluetoothRemotePasskey', | 20 REMOTE_PASSKEY: 'bluetoothRemotePasskey', |
21 CONFIRM_PASSKEY: 'bluetoothConfirmPasskey', | 21 CONFIRM_PASSKEY: 'bluetoothConfirmPasskey', |
22 CONNECT_FAILED: 'bluetoothConnectFailed', | 22 CONNECT_FAILED: 'bluetoothConnectFailed', |
23 CANCELED: 'bluetoothPairingCanceled', | 23 CANCELED: 'bluetoothPairingCanceled', |
24 DISMISSED: 'bluetoothPairingDismissed', // pairing dismissed(succeeded or | 24 DISMISSED: 'bluetoothPairingDismissed', // pairing dismissed(succeeded or |
25 // canceled). | 25 // canceled). |
26 }; | 26 }; |
27 | 27 |
28 /** | 28 /** |
29 * List of IDs for conditionally visible elements in the dialog. | 29 * List of IDs for conditionally visible elements in the dialog. |
30 * @type {Array.<string>} | 30 * @type {Array<string>} |
31 * @const | 31 * @const |
32 */ | 32 */ |
33 var ELEMENTS = ['bluetooth-pairing-passkey-display', | 33 var ELEMENTS = ['bluetooth-pairing-passkey-display', |
34 'bluetooth-pairing-passkey-entry', | 34 'bluetooth-pairing-passkey-entry', |
35 'bluetooth-pairing-pincode-entry', | 35 'bluetooth-pairing-pincode-entry', |
36 'bluetooth-pair-device-connect-button', | 36 'bluetooth-pair-device-connect-button', |
37 'bluetooth-pair-device-cancel-button', | 37 'bluetooth-pair-device-cancel-button', |
38 'bluetooth-pair-device-accept-button', | 38 'bluetooth-pair-device-accept-button', |
39 'bluetooth-pair-device-reject-button', | 39 'bluetooth-pair-device-reject-button', |
40 'bluetooth-pair-device-dismiss-button']; | 40 'bluetooth-pair-device-dismiss-button']; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 /** @const */ var ENTER_KEY_CODE = 13; | 226 /** @const */ var ENTER_KEY_CODE = 13; |
227 if (event.keyCode == ENTER_KEY_CODE) { | 227 if (event.keyCode == ENTER_KEY_CODE) { |
228 var button = $('bluetooth-pair-device-connect-button'); | 228 var button = $('bluetooth-pair-device-connect-button'); |
229 if (!button.hidden) | 229 if (!button.hidden) |
230 button.click(); | 230 button.click(); |
231 } | 231 } |
232 }, | 232 }, |
233 | 233 |
234 /** | 234 /** |
235 * Updates the visibility of elements in the dialog. | 235 * Updates the visibility of elements in the dialog. |
236 * @param {Array.<string>} list List of conditionally visible elements that | 236 * @param {Array<string>} list List of conditionally visible elements that |
237 * are to be made visible. | 237 * are to be made visible. |
238 * @private | 238 * @private |
239 */ | 239 */ |
240 displayElements_: function(list) { | 240 displayElements_: function(list) { |
241 var enabled = {}; | 241 var enabled = {}; |
242 for (var i = 0; i < list.length; i++) { | 242 for (var i = 0; i < list.length; i++) { |
243 var key = list[i]; | 243 var key = list[i]; |
244 enabled[key] = true; | 244 enabled[key] = true; |
245 } | 245 } |
246 for (var i = 0; i < ELEMENTS.length; i++) { | 246 for (var i = 0; i < ELEMENTS.length; i++) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 dialog.device_.pairing = PAIRING.DISMISSED; | 366 dialog.device_.pairing = PAIRING.DISMISSED; |
367 PageManager.closeOverlay(); | 367 PageManager.closeOverlay(); |
368 } | 368 } |
369 }; | 369 }; |
370 | 370 |
371 // Export | 371 // Export |
372 return { | 372 return { |
373 BluetoothPairing: BluetoothPairing | 373 BluetoothPairing: BluetoothPairing |
374 }; | 374 }; |
375 }); | 375 }); |
OLD | NEW |