Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js

Issue 2684793004: [Harmony] Harmonize Bluetooth dialogs. (Closed)
Patch Set: Address jamescook@'s comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * Enumeration of possible states during pairing. The value associated with 6 * Enumeration of possible states during pairing. The value associated with
7 * each state maps to a localized string in the global variable 7 * each state maps to a localized string in the global variable
8 * |loadTimeData|. 8 * |loadTimeData|.
9 * @enum {string} 9 * @enum {string}
10 */ 10 */
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 inputField.value.length == 0; 173 inputField.value.length == 0;
174 }; 174 };
175 $('bluetooth-pincode').oninput = function() { 175 $('bluetooth-pincode').oninput = function() {
176 $('bluetooth-pair-device-connect-button').disabled = 176 $('bluetooth-pair-device-connect-button').disabled =
177 $('bluetooth-pincode').value.length == 0; 177 $('bluetooth-pincode').value.length == 0;
178 }; 178 };
179 $('bluetooth-passkey').addEventListener('keydown', 179 $('bluetooth-passkey').addEventListener('keydown',
180 this.keyDownEventHandler_.bind(this)); 180 this.keyDownEventHandler_.bind(this));
181 $('bluetooth-pincode').addEventListener('keydown', 181 $('bluetooth-pincode').addEventListener('keydown',
182 this.keyDownEventHandler_.bind(this)); 182 this.keyDownEventHandler_.bind(this));
183 $('bluetooth-pairing-close-button').addEventListener('click',
184 this.onClose_.bind(this));
183 }, 185 },
184 186
185 /** @override */ 187 /** @override */
186 didClosePage: function() { 188 didClosePage: function() {
187 if (this.event_ && 189 if (this.event_ &&
188 this.event_.pairing != BluetoothPairingEventType.DISMISSED && 190 this.event_.pairing != BluetoothPairingEventType.DISMISSED &&
189 this.event_.pairing != BluetoothPairingEventType.CONNECT_FAILED) { 191 this.event_.pairing != BluetoothPairingEventType.CONNECT_FAILED) {
190 this.event_.pairing = BluetoothPairingEventType.CANCELED; 192 this.event_.pairing = BluetoothPairingEventType.CANCELED;
191 var options = { 193 var options = {
192 device: this.event_.device, 194 device: this.event_.device,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 keyDownEventHandler_: function(event) { 331 keyDownEventHandler_: function(event) {
330 /** @const */ var ENTER_KEY_CODE = 13; 332 /** @const */ var ENTER_KEY_CODE = 13;
331 if (event.keyCode == ENTER_KEY_CODE) { 333 if (event.keyCode == ENTER_KEY_CODE) {
332 var button = $('bluetooth-pair-device-connect-button'); 334 var button = $('bluetooth-pair-device-connect-button');
333 if (!button.hidden) 335 if (!button.hidden)
334 button.click(); 336 button.click();
335 } 337 }
336 }, 338 },
337 339
338 /** 340 /**
341 * Handles the click event on the close button.
342 * @param {Event} event A click down event.
343 * @private
344 */
345 onClose_: function(event) {
346 event.preventDefault();
347 chrome.send('dialogClose');
348 },
349
350 /**
339 * Updates the visibility of elements in the dialog. 351 * Updates the visibility of elements in the dialog.
340 * @param {Array<string>} list List of conditionally visible elements that 352 * @param {Array<string>} list List of conditionally visible elements that
341 * are to be made visible. 353 * are to be made visible.
342 * @private 354 * @private
343 */ 355 */
344 displayElements_: function(list) { 356 displayElements_: function(list) {
345 var enabled = {}; 357 var enabled = {};
346 for (var i = 0; i < list.length; i++) { 358 for (var i = 0; i < list.length; i++) {
347 var key = list[i]; 359 var key = list[i];
348 enabled[key] = true; 360 enabled[key] = true;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 dialog.event_.pairing = BluetoothPairingEventType.DISMISSED; 599 dialog.event_.pairing = BluetoothPairingEventType.DISMISSED;
588 PageManager.closeOverlay(); 600 PageManager.closeOverlay();
589 } 601 }
590 }; 602 };
591 603
592 // Export 604 // Export
593 return { 605 return {
594 BluetoothPairing: BluetoothPairing 606 BluetoothPairing: BluetoothPairing
595 }; 607 };
596 }); 608 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698