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

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

Issue 2568593002: MD Settings: Internet: Only show detailed info for primary user. (Closed)
Patch Set: Rebase Created 4 years 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/internet_detail_page.js
diff --git a/chrome/browser/resources/settings/internet_page/internet_detail_page.js b/chrome/browser/resources/settings/internet_page/internet_detail_page.js
index e37ad1ad976255edabafed5fc6b5f45d6eec160f..edcc55393e5ee7fd86dcd2a75b7d4b56c536d7d3 100644
--- a/chrome/browser/resources/settings/internet_page/internet_detail_page.js
+++ b/chrome/browser/resources/settings/internet_page/internet_detail_page.js
@@ -37,6 +37,15 @@ Polymer({
notify: true,
},
+ /** Email address for the primary user when user is a secondary user. */
+ primaryUserEmail_: {
+ type: String,
+ value: function() {
+ return loadTimeData.getBoolean('isSecondaryUser') ?
+ loadTimeData.getString('primaryUserEmail') : '';
+ },
+ },
+
/**
* Highest priority connected network or null.
* @type {?CrOnc.NetworkStateProperties}
@@ -207,8 +216,13 @@ Polymer({
*/
getNetworkDetails_: function() {
assert(!!this.guid);
- this.networkingPrivate.getManagedProperties(
- this.guid, this.getPropertiesCallback_.bind(this));
+ if (this.isSecondaryUser_()) {
+ this.networkingPrivate.getState(
+ this.guid, this.getStateCallback_.bind(this));
+ } else {
+ this.networkingPrivate.getManagedProperties(
+ this.guid, this.getPropertiesCallback_.bind(this));
+ }
},
/**
@@ -227,6 +241,27 @@ Polymer({
},
/**
+ * networkingPrivate.getProperties callback.
michaelpg 2016/12/12 23:17:00 getState
stevenjb 2016/12/13 00:57:55 Done.
+ * @param {CrOnc.NetworkStateProperties} state The network state properties.
+ * @private
+ */
+ getStateCallback_: function(state) {
+ if (!state) {
+ // If |properties| becomes null (i.e. the network is no longer visible),
michaelpg 2016/12/12 23:17:00 |state|?
stevenjb 2016/12/13 00:57:55 Done.
+ // close the page.
+ console.error('Network no longer exists: ' + this.guid);
+ this.networkProperties = undefined;
+ this.close_();
+ }
+ this.networkProperties = {
+ GUID: state.GUID,
+ Type: state.Type,
+ Connectable: state.Connectable,
+ ConnectionState: state.ConnectionState,
+ };
+ },
+
+ /**
* @param {!chrome.networkingPrivate.NetworkConfigProperties} onc The ONC
* network properties.
* @private
@@ -270,6 +305,14 @@ Polymer({
},
/**
+ * @return {boolean} True if settings are for a secondary user.
+ * @private
+ */
+ isSecondaryUser_: function() {
+ return !!this.primaryUserEmail_;
michaelpg 2016/12/12 23:17:00 Can we use loadTimeData.getBoolean('isSecondaryUse
stevenjb 2016/12/13 00:57:55 In that case I may as well make this a property, w
+ },
+
+ /**
* @return {boolean}
* @private
*/

Powered by Google App Engine
This is Rietveld 408576698