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

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

Issue 13870020: Bluetooth: Add support for pairing display notifications (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits Created 7 years, 8 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
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 cr.define('options', function() { 5 cr.define('options', function() {
6 /** @const */ var OptionsPage = options.OptionsPage; 6 /** @const */ var OptionsPage = options.OptionsPage;
7 7
8 /** 8 /**
9 * Enumeration of possible states during pairing. The value associated with 9 * Enumeration of possible states during pairing. The value associated with
10 * each state maps to a localized string in the global variable 10 * each state maps to a localized string in the global variable
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 /** 268 /**
269 * Formats an element for displaying the passkey. 269 * Formats an element for displaying the passkey.
270 */ 270 */
271 updatePasskey_: function() { 271 updatePasskey_: function() {
272 var passkeyEl = $('bluetooth-pairing-passkey-display'); 272 var passkeyEl = $('bluetooth-pairing-passkey-display');
273 var keyClass = this.device_.pairing == PAIRING.REMOTE_PASSKEY ? 273 var keyClass = this.device_.pairing == PAIRING.REMOTE_PASSKEY ?
274 'bluetooth-keyboard-button' : 'bluetooth-passkey-char'; 274 'bluetooth-keyboard-button' : 'bluetooth-passkey-char';
275 this.clearElement_(passkeyEl); 275 this.clearElement_(passkeyEl);
276 var key = String(this.device_.passkey); 276 var key = String(this.device_.passkey);
277 var progress = this.device_.entered | 0; 277 var progress = this.device_.entered;
278 for (var i = 0; i < key.length; i++) { 278 for (var i = 0; i < key.length; i++) {
279 var keyEl = document.createElement('span'); 279 var keyEl = document.createElement('span');
280 keyEl.textContent = key.charAt(i); 280 keyEl.textContent = key.charAt(i);
281 keyEl.className = keyClass; 281 keyEl.className = keyClass;
282 if (i < progress) 282 if (progress == undefined)
283 keyEl.classList.add('key-pin');
284 else if (i < progress)
283 keyEl.classList.add('key-typed'); 285 keyEl.classList.add('key-typed');
284 passkeyEl.appendChild(keyEl); 286 passkeyEl.appendChild(keyEl);
285 } 287 }
286 if (this.device_.pairing == PAIRING.REMOTE_PASSKEY) { 288 if (this.device_.pairing == PAIRING.REMOTE_PASSKEY) {
287 // Add enter key. 289 // Add enter key.
288 var label = loadTimeData.getString('bluetoothEnterKey'); 290 var label = loadTimeData.getString('bluetoothEnterKey');
289 var keyEl = document.createElement('span'); 291 var keyEl = document.createElement('span');
290 keyEl.textContent = label; 292 keyEl.textContent = label;
291 keyEl.className = keyClass; 293 keyEl.className = keyClass;
292 keyEl.id = 'bluetooth-enter-key'; 294 keyEl.id = 'bluetooth-enter-key';
295 if (progress == undefined)
296 keyEl.classList.add('key-pin');
297 else if (progress > key.length)
298 keyEl.classList.add('key-typed');
293 passkeyEl.appendChild(keyEl); 299 passkeyEl.appendChild(keyEl);
294 } 300 }
295 passkeyEl.hidden = false; 301 passkeyEl.hidden = false;
296 }, 302 },
297 303
298 /** 304 /**
299 * Formats an element for displaying the PIN code. 305 * Formats an element for displaying the PIN code.
300 */ 306 */
301 updatePinCode_: function() { 307 updatePinCode_: function() {
302 var passkeyEl = $('bluetooth-pairing-passkey-display'); 308 var passkeyEl = $('bluetooth-pairing-passkey-display');
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 dialog.device_.pairing = PAIRING.DISMISSED; 386 dialog.device_.pairing = PAIRING.DISMISSED;
381 OptionsPage.closeOverlay(); 387 OptionsPage.closeOverlay();
382 } 388 }
383 }; 389 };
384 390
385 // Export 391 // Export
386 return { 392 return {
387 BluetoothPairing: BluetoothPairing 393 BluetoothPairing: BluetoothPairing
388 }; 394 };
389 }); 395 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698