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

Side by Side Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js

Issue 2161753002: MD Settings: Bluetooth dialog, remove unnecessary 'close-dialog' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 5 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/settings/bluetooth_page/bluetooth_page.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 6 * @fileoverview
7 * 'settings-bluetooth-page' is the settings page for managing bluetooth 7 * 'settings-bluetooth-page' is the settings page for managing bluetooth
8 * properties and devices. 8 * properties and devices.
9 * 9 *
10 * Example: 10 * Example:
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 /** @type {!chrome.bluetoothPrivate.SetPairingResponseOptions} */ ( 376 /** @type {!chrome.bluetoothPrivate.SetPairingResponseOptions} */ (
377 e.detail); 377 e.detail);
378 this.bluetoothPrivate.setPairingResponse(options, function() { 378 this.bluetoothPrivate.setPairingResponse(options, function() {
379 if (chrome.runtime.lastError) { 379 if (chrome.runtime.lastError) {
380 // TODO(stevenjb): Show error. 380 // TODO(stevenjb): Show error.
381 console.error( 381 console.error(
382 'Error setting pairing response: ' + options.device.name + 382 'Error setting pairing response: ' + options.device.name +
383 ': Response: ' + options.response + ': Error: ' + 383 ': Response: ' + options.response + ': Error: ' +
384 chrome.runtime.lastError.message); 384 chrome.runtime.lastError.message);
385 } 385 }
386 this.closeDialog_(); 386 this.$$('#deviceDialog').close();
387 }.bind(this)); 387 }.bind(this));
388 }, 388 },
389 389
390 /** 390 /**
391 * @param {string} address 391 * @param {string} address
392 * @return {number} The index of the device associated with |address| or -1. 392 * @return {number} The index of the device associated with |address| or -1.
393 * @private 393 * @private
394 */ 394 */
395 getDeviceIndex_: function(address) { 395 getDeviceIndex_: function(address) {
396 var len = this.deviceList.length; 396 var len = this.deviceList.length;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 case chrome.bluetoothPrivate.ConnectResultType.AUTH_CANCELED: 450 case chrome.bluetoothPrivate.ConnectResultType.AUTH_CANCELED:
451 case chrome.bluetoothPrivate.ConnectResultType.IN_PROGRESS: 451 case chrome.bluetoothPrivate.ConnectResultType.IN_PROGRESS:
452 case chrome.bluetoothPrivate.ConnectResultType.SUCCESS: 452 case chrome.bluetoothPrivate.ConnectResultType.SUCCESS:
453 break; 453 break;
454 default: 454 default:
455 error = result; 455 error = result;
456 } 456 }
457 } 457 }
458 458
459 if (!error) { 459 if (!error) {
460 this.closeDialog_(); 460 this.$$('#deviceDialog').close();
461 return; 461 return;
462 } 462 }
463 463
464 var name = this.getDeviceName_(device); 464 var name = this.getDeviceName_(device);
465 var id = 'bluetooth_connect_' + error; 465 var id = 'bluetooth_connect_' + error;
466 if (this.i18nExists(id)) { 466 if (this.i18nExists(id)) {
467 this.errorMessage = this.i18n(id, name); 467 this.errorMessage = this.i18n(id, name);
468 } else { 468 } else {
469 this.errorMessage = error; 469 this.errorMessage = error;
470 console.error('Unexpected error connecting to: ' + name + ': ' + error); 470 console.error('Unexpected error connecting to: ' + name + ': ' + error);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 522 }
523 this.dialogId = dialogId; 523 this.dialogId = dialogId;
524 // Call flush so that the dialog gets sized correctly before it is opened. 524 // Call flush so that the dialog gets sized correctly before it is opened.
525 Polymer.dom.flush(); 525 Polymer.dom.flush();
526 var dialog = this.$$('#deviceDialog'); 526 var dialog = this.$$('#deviceDialog');
527 dialog.open(); 527 dialog.open();
528 dialog.focus(); 528 dialog.focus();
529 }, 529 },
530 530
531 /** @private */ 531 /** @private */
532 closeDialog_: function() { 532 onDialogClosed_: function() {
533 if (!this.dialogId) 533 this.stopDiscovery_();
534 return;
535 var dialog = this.$$('#deviceDialog');
536 dialog.close();
537 this.dialogId = ''; 534 this.dialogId = '';
538 this.pairingDevice = null; 535 this.pairingDevice = null;
539 this.pairingEvent = null; 536 this.pairingEvent = null;
540 }, 537 },
541 538
542 /** @private */ 539 /** @private */
543 onCloseDialog_: function(event) { this.closeDialog_(); },
544
545 /** @private */
546 onDialogOpened_: function() { this.startDiscovery_(); }, 540 onDialogOpened_: function() { this.startDiscovery_(); },
547
548 /** @private */
549 onDialogClosed_: function() { this.stopDiscovery_(); },
550 }); 541 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698