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

Side by Side Diff: chrome/browser/resources/settings/internet_page/network_siminfo.js

Issue 2817803002: MD Settings: CrOS: Focus elements on dialog close (Closed)
Patch Set: . Created 3 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 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 Polymer element for displaying and modifying cellular sim info. 6 * @fileoverview Polymer element for displaying and modifying cellular sim info.
7 */ 7 */
8 (function() { 8 (function() {
9 9
10 /** @enum {string} */ 10 /** @enum {string} */
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 this.$.changePinDialog.close(); 92 this.$.changePinDialog.close();
93 showUnlockPuk = true; 93 showUnlockPuk = true;
94 } 94 }
95 if (this.$.unlockPinDialog.open) { 95 if (this.$.unlockPinDialog.open) {
96 this.$.unlockPinDialog.close(); 96 this.$.unlockPinDialog.close();
97 showUnlockPuk = true; 97 showUnlockPuk = true;
98 } 98 }
99 if (!showUnlockPuk) 99 if (!showUnlockPuk)
100 return; 100 return;
101 101
102 this.error_ = ErrorType.NONE; 102 this.showUnlockPukDialog_();
103 this.$.unlockPukDialog.showModal();
104 }, 103 },
105 104
106 /** 105 /**
107 * Opens the pin dialog when the sim lock enabled state changes. 106 * Opens the pin dialog when the sim lock enabled state changes.
108 * @param {Event} event 107 * @param {Event} event
109 * @private 108 * @private
110 */ 109 */
111 onSimLockEnabledChange_: function(event) { 110 onSimLockEnabledChange_: function(event) {
112 if (!this.networkProperties || !this.networkProperties.Cellular) 111 if (!this.networkProperties || !this.networkProperties.Cellular)
113 return; 112 return;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if (chrome.runtime.lastError) { 212 if (chrome.runtime.lastError) {
214 this.error_ = ErrorType.INCORRECT_PIN; 213 this.error_ = ErrorType.INCORRECT_PIN;
215 this.$.unlockPin.inputElement.select(); 214 this.$.unlockPin.inputElement.select();
216 } else { 215 } else {
217 this.error_ = ErrorType.NONE; 216 this.error_ = ErrorType.NONE;
218 this.$.unlockPinDialog.close(); 217 this.$.unlockPinDialog.close();
219 } 218 }
220 }.bind(this)); 219 }.bind(this));
221 }, 220 },
222 221
223 /** 222 /** @private */
224 * Opens the Unlock PUK dialog. 223 showUnlockPukDialog_: function() {
225 * @param {Event} event
226 * @private
227 */
228 unlockPuk_: function(event) {
229 this.error_ = ErrorType.NONE; 224 this.error_ = ErrorType.NONE;
230 this.$.unlockPukDialog.showModal(); 225 this.$.unlockPukDialog.showModal();
231 this.$.unlockPuk.value = ''; 226 this.$.unlockPuk.value = '';
dpapad 2017/04/13 00:16:40 How about initializing those three values before c
stevenjb 2017/04/13 00:39:09 Done.
232 this.$.unlockPin1.value = ''; 227 this.$.unlockPin1.value = '';
233 this.$.unlockPin2.value = ''; 228 this.$.unlockPin2.value = '';
234 }, 229 },
235 230
236 /** 231 /**
237 * Sends the PUK value and new PIN value from the Unblock PUK dialog. 232 * Sends the PUK value and new PIN value from the Unblock PUK dialog.
238 * @param {Event} event 233 * @param {Event} event
239 * @private 234 * @private
240 */ 235 */
241 sendUnlockPuk_: function(event) { 236 sendUnlockPuk_: function(event) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 * @param {string} puk 330 * @param {string} puk
336 * @return {boolean} True if the puk is of minimum length. 331 * @return {boolean} True if the puk is of minimum length.
337 * @private 332 * @private
338 */ 333 */
339 validatePuk_: function(puk) { 334 validatePuk_: function(puk) {
340 if (puk.length < PUK_MIN_LENGTH) { 335 if (puk.length < PUK_MIN_LENGTH) {
341 this.error_ = ErrorType.INVALID_PUK; 336 this.error_ = ErrorType.INVALID_PUK;
342 return false; 337 return false;
343 } 338 }
344 return true; 339 return true;
345 } 340 },
341
342 /** @private */
343 onEnterPinDialogClosed_: function() {
344 this.$$('#simLockButton').focus();
345 },
346
347 /** @private */
348 onChangePinDialogClose_: function() {
349 this.$$('#changePinButton').focus();
350 },
351
352 /** @private */
353 onUnlockPinDialogClose__: function() {
dpapad 2017/04/13 00:16:40 Typo: There are two underscores here, which makes
stevenjb 2017/04/13 00:39:09 Thanks. Sadly these are extremely difficult to tes
354 this.$$('#unlockPinButton').focus();
355 },
346 }); 356 });
347 })(); 357 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698