Commit 0823e684 authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[OsSettings] Add row getter to Network Summary and use in InternetPage

Better encapsulate network-summary by preventing InternetPage from
directly accessing its DOM. Adds getNetworkRow public getter method
and uses it in InternetPage.

Change-Id: I8a42c5e13db9476b2bc600e3b6e0d97be3390c6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2341757Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Daniel Classon <dclasson@google.com>
Cr-Commit-Position: refs/heads/master@{#795692}
parent d025fe59
......@@ -209,8 +209,8 @@ Polymer({
element = subPage.$$('#networkList');
}
} else if (this.detailType_ !== undefined) {
const oncType = OncMojo.getNetworkTypeString(this.detailType_);
const rowForDetailType = this.$$('network-summary').$$(`#${oncType}`);
const rowForDetailType =
this.$$('network-summary').getNetworkRow(this.detailType_);
// Note: It is possible that the row is no longer present in the DOM
// (e.g., when a Cellular dongle is unplugged or when Instant Tethering
......
......@@ -125,6 +125,17 @@ Polymer({
this.getNetworkLists_();
},
/*
* Returns the network-summary-item element corresponding to the
* |networkType|.
* @param {!chromeos.networkConfig.mojom.NetworkType} networkType
* @return {?NetworkSummaryItemElement}
*/
getNetworkRow(networkType) {
const networkTypeString = OncMojo.getNetworkTypeString(networkType);
return this.$$(`#${networkTypeString}`);
},
/**
* Requests the list of device states and network states from Chrome.
* Updates deviceStates, activeNetworkStates, and networkStateLists once the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment