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

Unified Diff: chrome/browser/resources/settings/internet_page/network_summary_item.js

Issue 2303093003: MD Settings: Internet: Enable SIM unlock with no cellular network (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/internet_page/network_summary_item.js
diff --git a/chrome/browser/resources/settings/internet_page/network_summary_item.js b/chrome/browser/resources/settings/internet_page/network_summary_item.js
index 114c0f5db9e194c91637e55ecec47b728adcf41e..617216cf81fd8b0d9cc12fb81a8206e1e63e74f0 100644
--- a/chrome/browser/resources/settings/internet_page/network_summary_item.js
+++ b/chrome/browser/resources/settings/internet_page/network_summary_item.js
@@ -13,6 +13,8 @@ var DeviceStateProperties;
Polymer({
is: 'network-summary-item',
+ behaviors: [Polymer.IronA11yKeysBehavior],
+
properties: {
/**
* Device state for the network type.
@@ -27,10 +29,7 @@ Polymer({
* Network state for the active network.
* @type {!CrOnc.NetworkStateProperties|undefined}
*/
- activeNetworkState: {
- type: Object,
- observer: 'activeNetworkStateChanged_',
- },
+ activeNetworkState: Object,
/**
* List of all network state data for the network type.
@@ -41,7 +40,6 @@ Polymer({
value: function() {
return [];
},
- observer: 'networkStateListChanged_',
},
/** The maximum height in pixels for the list of networks. */
@@ -51,6 +49,12 @@ Polymer({
},
/**
+ * Interface for networkingPrivate calls, passed from internet_page.
+ * @type {NetworkingPrivate}
+ */
+ networkingPrivate: Object,
+
+ /**
* The expanded state of the list of networks.
* @private
*/
@@ -71,6 +75,10 @@ Polymer({
},
},
+ keyBindings: {
+ 'enter': 'onDetailsTap_',
+ },
+
/** @private */
expandedChanged_: function() {
var type = this.deviceState ? this.deviceState.Type : '';
@@ -79,27 +87,52 @@ Polymer({
/** @private */
deviceStateChanged_: function() {
- this.updateSelectable_();
if (this.expanded_ && !this.deviceIsEnabled_())
this.expanded_ = false;
},
- /** @private */
- activeNetworkStateChanged_: function() {
- this.updateSelectable_();
+ /**
+ * @return {boolean} Whether or not the scanning spinner should be shown.
+ * @private
+ */
+ showScanning_: function() {
+ return !!this.expanded_ && !!this.deviceState.Scanning;
},
- /** @private */
- networkStateListChanged_: function() {
- this.updateSelectable_();
+ /**
+ * Show the <network-siminfo> element if this is a disabled and locked
+ * cellular device.
+ * @return {boolean}
+ * @private
+ */
+ showSimInfo_: function() {
+ let device = this.deviceState;
+ if (device.Type != CrOnc.Type.CELLULAR || this.deviceIsEnabled_())
+ return false;
+ return device.SimPresent === false ||
+ device.SimLockType == CrOnc.LockType.PIN ||
+ device.SimLockType == CrOnc.LockType.PUK;
},
/**
- * @return {boolean} Whether or not the scanning spinner should be shown.
+ * Returns a NetworkProperties object for <network-siminfo> built from
+ * the device properties (since there will be no active network).
+ * @return {!CrOnc.NetworkProperties}
* @private
*/
- showScanning_: function() {
- return !!this.expanded_ && !!this.deviceState.Scanning;
+ getCellularState_: function() {
+ let device = this.deviceState;
+ return {
+ GUID: '',
+ Type: CrOnc.Type.CELLULAR,
+ Cellular: {
+ SIMLockStatus: {
+ LockType: device.SimLockType || '',
+ LockEnabled: device.SimLockType != CrOnc.LockType.NONE
+ },
+ SIMPresent: device.SimPresent,
+ },
+ };
},
/**
@@ -144,11 +177,20 @@ Polymer({
* @private
*/
enableIsVisible_: function() {
- return !!this.deviceState && this.deviceState.Type != CrOnc.Type.ETHERNET &&
+ return this.deviceState.Type != CrOnc.Type.ETHERNET &&
this.deviceState.Type != CrOnc.Type.VPN;
},
/**
+ * @return {boolean}
+ * @private
+ */
+ showDetailsIsVisible_: function() {
+ return this.deviceState.Type == CrOnc.Type.CELLULAR &&
+ this.networkStateList.length == 1;
+ },
+
+ /**
* @return {boolean} Whether or not to show the UI to expand the list.
* @private
*/
@@ -176,7 +218,7 @@ Polymer({
* @private
*/
onDetailsTap_: function(event) {
- if ((event.target.id == 'expandListButton') ||
+ if ((event.target && event.target.id == 'expandListButton') ||
(this.deviceState && !this.deviceIsEnabled_())) {
// Already handled or disabled, do nothing.
return;
@@ -191,6 +233,17 @@ Polymer({
},
/**
+ * @param {Event} event The enable button event.
michaelpg 2016/09/06 21:10:38 !Event
stevenjb 2016/09/12 19:46:42 Done.
+ * @private
+ */
+ onShowDetailsTap_: function(event) {
+ if (this.activeNetworkState.GUID != '') {
+ this.fire('show-detail', this.activeNetworkState);
michaelpg 2016/09/06 21:10:38 optional: early return?
stevenjb 2016/09/12 19:46:42 Done.
+ event.stopPropagation();
+ }
+ },
+
+ /**
* Event triggered when the known networks button is tapped.
* @private
*/
@@ -213,11 +266,10 @@ Polymer({
},
/**
- * Called whenever the 'selectable' state might change.
+ * @return {string}
* @private
*/
- updateSelectable_: function() {
- var selectable = this.deviceIsEnabled_();
- this.$.details.classList.toggle('selectable', selectable);
+ getTabIndex_: function() {
+ return this.deviceIsEnabled_() ? '0' : '-1';
},
});

Powered by Google App Engine
This is Rietveld 408576698