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

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

Issue 2303093003: MD Settings: Internet: Enable SIM unlock with no cellular network (Closed)
Patch Set: No settings_vars_css cleanup Created 4 years, 3 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 this.$.enterPinDialog.showModal(); 116 this.$.enterPinDialog.showModal();
117 this.$.enterPin.value = ''; 117 this.$.enterPin.value = '';
118 }, 118 },
119 119
120 /** 120 /**
121 * Sends the PIN value from the Enter PIN dialog. 121 * Sends the PIN value from the Enter PIN dialog.
122 * @param {Event} event 122 * @param {Event} event
123 * @private 123 * @private
124 */ 124 */
125 sendEnterPin_: function(event) { 125 sendEnterPin_: function(event) {
126 var guid = this.networkProperties && this.networkProperties.GUID; 126 var guid = (this.networkProperties && this.networkProperties.GUID) || '';
127 if (!guid)
128 return;
129
130 var pin = this.$.enterPin.value; 127 var pin = this.$.enterPin.value;
131 if (!this.validatePin_(pin)) 128 if (!this.validatePin_(pin))
132 return; 129 return;
133 130
134 var simState = /** @type {!CrOnc.CellularSimState} */ ({ 131 var simState = /** @type {!CrOnc.CellularSimState} */ ({
135 currentPin: pin, 132 currentPin: pin,
136 requirePin: this.sendSimLockEnabled_, 133 requirePin: this.sendSimLockEnabled_,
137 }); 134 });
138 this.networkingPrivate.setCellularSimState(guid, simState, function() { 135 this.networkingPrivate.setCellularSimState(guid, simState, function() {
139 if (chrome.runtime.lastError) { 136 if (chrome.runtime.lastError) {
(...skipping 20 matching lines...) Expand all
160 this.$.changePinNew1.value = ''; 157 this.$.changePinNew1.value = '';
161 this.$.changePinNew2.value = ''; 158 this.$.changePinNew2.value = '';
162 }, 159 },
163 160
164 /** 161 /**
165 * Sends the old and new PIN values from the Change PIN dialog. 162 * Sends the old and new PIN values from the Change PIN dialog.
166 * @param {Event} event 163 * @param {Event} event
167 * @private 164 * @private
168 */ 165 */
169 sendChangePin_: function(event) { 166 sendChangePin_: function(event) {
170 var guid = this.networkProperties && this.networkProperties.GUID; 167 var guid = (this.networkProperties && this.networkProperties.GUID) || '';
171 if (!guid)
172 return;
173
174 var newPin = this.$.changePinNew1.value; 168 var newPin = this.$.changePinNew1.value;
175 if (!this.validatePin_(newPin, this.$.changePinNew2.value)) 169 if (!this.validatePin_(newPin, this.$.changePinNew2.value))
176 return; 170 return;
177 171
178 var simState = /** @type {!CrOnc.CellularSimState} */ ({ 172 var simState = /** @type {!CrOnc.CellularSimState} */ ({
179 requirePin: true, 173 requirePin: true,
180 currentPin: this.$.changePinOld.value, 174 currentPin: this.$.changePinOld.value,
181 newPin: newPin 175 newPin: newPin
182 }); 176 });
183 this.networkingPrivate.setCellularSimState(guid, simState, function() { 177 this.networkingPrivate.setCellularSimState(guid, simState, function() {
(...skipping 17 matching lines...) Expand all
201 this.$.unlockPinDialog.showModal(); 195 this.$.unlockPinDialog.showModal();
202 this.$.unlockPin.value = ''; 196 this.$.unlockPin.value = '';
203 }, 197 },
204 198
205 /** 199 /**
206 * Sends the PIN value from the Unlock PIN dialog. 200 * Sends the PIN value from the Unlock PIN dialog.
207 * @param {Event} event 201 * @param {Event} event
208 * @private 202 * @private
209 */ 203 */
210 sendUnlockPin_: function(event) { 204 sendUnlockPin_: function(event) {
211 var guid = this.networkProperties && this.networkProperties.GUID; 205 var guid = (this.networkProperties && this.networkProperties.GUID) || '';
212 if (!guid)
213 return;
214 var pin = this.$.unlockPin.value; 206 var pin = this.$.unlockPin.value;
215 if (!this.validatePin_(pin)) 207 if (!this.validatePin_(pin))
216 return; 208 return;
217 209
218 this.networkingPrivate.unlockCellularSim(guid, pin, '', function() { 210 this.networkingPrivate.unlockCellularSim(guid, pin, '', function() {
219 if (chrome.runtime.lastError) { 211 if (chrome.runtime.lastError) {
220 this.error_ = ErrorType.INCORRECT_PIN; 212 this.error_ = ErrorType.INCORRECT_PIN;
221 this.$.unlockPin.inputElement.select(); 213 this.$.unlockPin.inputElement.select();
222 } else { 214 } else {
223 this.error_ = ErrorType.NONE; 215 this.error_ = ErrorType.NONE;
(...skipping 14 matching lines...) Expand all
238 this.$.unlockPin1.value = ''; 230 this.$.unlockPin1.value = '';
239 this.$.unlockPin2.value = ''; 231 this.$.unlockPin2.value = '';
240 }, 232 },
241 233
242 /** 234 /**
243 * Sends the PUK value and new PIN value from the Unblock PUK dialog. 235 * Sends the PUK value and new PIN value from the Unblock PUK dialog.
244 * @param {Event} event 236 * @param {Event} event
245 * @private 237 * @private
246 */ 238 */
247 sendUnlockPuk_: function(event) { 239 sendUnlockPuk_: function(event) {
248 var guid = this.networkProperties && this.networkProperties.GUID; 240 var guid = (this.networkProperties && this.networkProperties.GUID) || '';
249 if (!guid)
250 return;
251
252 var puk = this.$.unlockPuk.value; 241 var puk = this.$.unlockPuk.value;
253 if (!this.validatePuk_(puk)) 242 if (!this.validatePuk_(puk))
254 return; 243 return;
255 var pin = this.$.unlockPin1.value; 244 var pin = this.$.unlockPin1.value;
256 if (!this.validatePin_(pin, this.$.unlockPin2.value)) 245 if (!this.validatePin_(pin, this.$.unlockPin2.value))
257 return; 246 return;
258 247
259 this.networkingPrivate.unlockCellularSim(guid, pin, puk, function() { 248 this.networkingPrivate.unlockCellularSim(guid, pin, puk, function() {
260 if (chrome.runtime.lastError) { 249 if (chrome.runtime.lastError) {
261 this.error_ = ErrorType.INCORRECT_PUK; 250 this.error_ = ErrorType.INCORRECT_PUK;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 */ 336 */
348 validatePuk_: function(puk) { 337 validatePuk_: function(puk) {
349 if (puk.length < PUK_MIN_LENGTH) { 338 if (puk.length < PUK_MIN_LENGTH) {
350 this.error_ = ErrorType.INVALID_PUK; 339 this.error_ = ErrorType.INVALID_PUK;
351 return false; 340 return false;
352 } 341 }
353 return true; 342 return true;
354 } 343 }
355 }); 344 });
356 })(); 345 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698