Chromium Code Reviews| Index: chrome/browser/resources/settings/internet_page/network_siminfo.js |
| diff --git a/chrome/browser/resources/settings/internet_page/network_siminfo.js b/chrome/browser/resources/settings/internet_page/network_siminfo.js |
| index 3d3bfd4ea141a3cb67dfa2376a84d5e4c711f686..7a5bcec80b7741a66d5a720cf518cb84e896bb54 100644 |
| --- a/chrome/browser/resources/settings/internet_page/network_siminfo.js |
| +++ b/chrome/browser/resources/settings/internet_page/network_siminfo.js |
| @@ -3,8 +3,7 @@ |
| // found in the LICENSE file. |
| /** |
| - * @fileoverview Polymer element for displaying and modifying a list of cellular |
| - * access points. |
| + * @fileoverview Polymer element for displaying and modifying cellular sim info. |
| */ |
| (function() { |
| @@ -31,14 +30,14 @@ Polymer({ |
| */ |
| networkProperties: { |
| type: Object, |
| - observer: 'networkPropertiesChanged_' |
| + observer: 'networkPropertiesChanged_', |
| }, |
| /** Set to true when a PUK is required to unlock the SIM. */ |
| pukRequired: { |
| type: Boolean, |
| value: false, |
| - observer: 'pukRequiredChanged_' |
| + observer: 'pukRequiredChanged_', |
| }, |
| /** |
| @@ -47,7 +46,7 @@ Polymer({ |
| */ |
| error: { |
| type: Object, |
| - value: ErrorType.NONE |
| + value: ErrorType.NONE, |
| }, |
| /** |
| @@ -139,9 +138,9 @@ Polymer({ |
| if (!this.validatePin_(pin)) |
| return; |
| - var simState = /** @type {!CrOnc.CellularSimState} */({ |
| + var simState = /** @type {!CrOnc.CellularSimState} */ ({ |
| currentPin: pin, |
| - requirePin: this.sendSimLockEnabled_ |
| + requirePin: this.sendSimLockEnabled_, |
| }); |
| this.networkingPrivate.setCellularSimState(guid, simState, function() { |
| if (chrome.runtime.lastError) { |
| @@ -191,7 +190,7 @@ Polymer({ |
| if (!this.validatePin_(newPin, this.$.changePinNew2.value)) |
| return; |
| - var simState = /** @type {!CrOnc.CellularSimState} */({ |
| + var simState = /** @type {!CrOnc.CellularSimState} */ ({ |
| requirePin: true, |
| currentPin: this.$.changePinOld.value, |
| newPin: newPin |
| @@ -293,59 +292,62 @@ Polymer({ |
| this.error = ErrorType.INCORRECT_PUK; |
| } else { |
| this.error = ErrorType.NONE; |
| - this.$.unlockSimDialog.close(); |
| + this.$.unlockPukDialog.close(); |
| } |
| }.bind(this)); |
| }, |
| /** |
| * @param {!CrOnc.NetworkProperties|undefined} networkProperties |
| - * @return {boolean} True if the Cellular SIM is locked. |
| + * @return {boolean} |
| * @private |
| */ |
| - isSimLocked_: function(networkProperties) { |
| - return !!networkProperties && CrOnc.isSimLocked(networkProperties); |
| + showSimLocked_: function(networkProperties) { |
| + if (!networkProperties || !networkProperties.Cellular || |
| + !networkProperties.Cellular.SIMPresent) { |
| + return false; |
| + } |
| + return CrOnc.isSimLocked(networkProperties); |
| }, |
| /** |
| * @param {!CrOnc.NetworkProperties|undefined} networkProperties |
| - * @return {string} The message for the number of retries left. |
| - * @private |
| - */ |
| - getRetriesLeftMsg_: function(networkProperties) { |
| - var retriesLeft = |
| - this.get('Cellular.SIMLockStatus.RetriesLeft', networkProperties) || 0; |
| - // TODO(stevenjb): Localize |
| - return 'Retries left: ' + retriesLeft.toString(); |
| - }, |
| - |
| - /** |
| - * @param {string} error |
| - * @return {boolean} True if an error message should be shown for |error|. |
| + * @return {boolean} |
| * @private |
| */ |
| - showError_: function(error) { |
| - return !!error && error != ErrorType.NONE; |
| + showSimUnlocked_: function(networkProperties) { |
| + if (!networkProperties || !networkProperties.Cellular || |
| + !networkProperties.Cellular.SIMPresent) { |
| + return false; |
| + } |
| + return !CrOnc.isSimLocked(networkProperties); |
| }, |
| /** |
| - * @param {string} error |
| * @return {string} The error message to display for |error|. |
| * @private |
| */ |
| - getErrorMsg_: function(error) { |
| + getErrorMsg_: function(error, networkProperties) { |
|
dschuyler
2016/07/28 22:12:16
missing @param.
(may need to add file to compiled_
stevenjb
2016/07/29 17:48:34
I am going to remove networkProperties from all of
|
| + if (error == ErrorType.NONE) |
| + return ''; |
| // TODO(stevenjb_: Translate |
| + var msg; |
| if (error == ErrorType.INCORRECT_PIN) |
| - return 'Incorrect PIN.'; |
| - if (error == ErrorType.INCORRECT_PUK) |
| - return 'Incorrect PUK.'; |
| - if (error == ErrorType.MISMATCHED_PIN) |
| - return 'PIN values do not match.'; |
| - if (error == ErrorType.INVALID_PIN) |
| - return 'Invalid PIN.'; |
| - if (error == ErrorType.INVALID_PUK) |
| - return 'Invalid PUK.'; |
| - return ''; |
| + msg = 'Incorrect PIN.'; |
| + else if (error == ErrorType.INCORRECT_PUK) |
| + msg = 'Incorrect PUK.'; |
| + else if (error == ErrorType.MISMATCHED_PIN) |
| + msg = 'PIN values do not match.'; |
| + else if (error == ErrorType.INVALID_PIN) |
| + msg = 'Invalid PIN.'; |
| + else if (error == ErrorType.INVALID_PUK) |
| + msg = 'Invalid PUK.'; |
| + else |
| + return 'UNKNOWN ERROR'; |
| + var retriesLeft = |
| + this.get('Cellular.SIMLockStatus.RetriesLeft', networkProperties) || 0; |
| + msg += ' Retries left: ' + retriesLeft.toString(); |
| + return msg; |
| }, |
| /** |