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

Unified Diff: chrome/browser/resources/chromeos/network_ui/network_ui.js

Issue 1030963003: Use networkingPrivate types in JS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extract unrelated chnages Created 5 years, 9 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/chromeos/network_ui/network_ui.js
diff --git a/chrome/browser/resources/chromeos/network_ui/network_ui.js b/chrome/browser/resources/chromeos/network_ui/network_ui.js
index 35780ea2ef77385de946239ebf4c88a488ae08f5..7ee2871f2565738a5e85829b1175b8b2b1121b3c 100644
--- a/chrome/browser/resources/chromeos/network_ui/network_ui.js
+++ b/chrome/browser/resources/chromeos/network_ui/network_ui.js
@@ -59,8 +59,8 @@ var NetworkUI = (function() {
* nested property, e.g. 'WiFi.Security'. If any part of a nested key is
* missing, this will return undefined.
*
- * @param {!CrOnc.NetworkConfigType} networkState The network state
- * property dictionary.
+ * @param {!chrome.networkingPrivate.NetworkStateProperties} networkState The
+ * network state property dictionary.
* @param {string} key The ONC key for the property.
* @return {*} The value associated with the property or undefined if the
* key (any part of it) is not defined.
@@ -100,7 +100,8 @@ var NetworkUI = (function() {
/**
* Creates a cell with an icon representing the network state.
*
- * @param {CrOnc.NetworkConfigType} networkState The network state properties.
+ * @param {!chrome.networkingPrivate.NetworkStateProperties} networkState The
+ * network state properties.
* @return {!HTMLTableCellElement} The created td element that displays the
* icon.
*/
@@ -132,7 +133,8 @@ var NetworkUI = (function() {
* Creates a row in the network state table.
*
* @param {Array} stateFields The state fields to use for the row.
- * @param {CrOnc.NetworkConfigType} networkState The network state properties.
+ * @param {!chrome.networkingPrivate.NetworkStateProperties} networkState The
+ * network state properties.
* @return {!HTMLTableRowElement} The created tr element that contains the
* network state information.
*/
@@ -165,8 +167,9 @@ var NetworkUI = (function() {
* Creates a table for networks or favorites.
*
* @param {string} tablename The name of the table to be created.
- * @param {Array} stateFields The list of fields for the table.
- * @param {Array} states An array of network or favorite states.
+ * @param {!Array<string>} stateFields The list of fields for the table.
+ * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states
+ * An array of network or favorite states.
*/
var createStateTable = function(tablename, stateFields, states) {
var table = $(tablename);
@@ -174,8 +177,7 @@ var NetworkUI = (function() {
for (var i = 0; i < oldRows.length; ++i)
table.removeChild(oldRows[i]);
states.forEach(function(state) {
- table.appendChild(createStateTableRow(
- stateFields, /** @type {!CrOnc.NetworkConfigType} */(state)));
+ table.appendChild(createStateTableRow(stateFields, state));
});
};
@@ -192,15 +194,17 @@ var NetworkUI = (function() {
/**
* This callback function is triggered when visible networks are received.
*
- * @param {!Array<!Object>} states A list of network state information for
- * each visible network.
+ * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states
+ * A list of network state information for each visible network.
*/
var onVisibleNetworksReceived = function(states) {
- /** @type {CrOnc.NetworkConfigType} */ var defaultState;
+ /** @type {chrome.networkingPrivate.NetworkStateProperties} */ var
+ defaultState;
if (states.length > 0)
- defaultState = /** @type {!CrOnc.NetworkConfigType} */(states[0]);
+ defaultState = states[0];
var icon = /** @type {CrNetworkIconElement} */($('default-network-icon'));
- if (defaultState && defaultState.Type != 'VPN') {
+ if (defaultState &&
+ defaultState.Type != chrome.networkingPrivate.NetworkType.VPN) {
$('default-network-text').textContent =
loadTimeData.getStringF('defaultNetworkText',
defaultState.Name,
@@ -210,7 +214,7 @@ var NetworkUI = (function() {
$('default-network-text').textContent =
loadTimeData.getString('noNetworkText');
// Show the disconnected wifi icon if there are no networks.
- icon.networkType = CrOnc.Type.WIFI;
+ icon.networkType = chrome.networkingPrivate.NetworkType.WiFi;
}
createStateTable('network-state-table', NETWORK_STATE_FIELDS, states);
@@ -219,8 +223,8 @@ var NetworkUI = (function() {
/**
* This callback function is triggered when favorite networks are received.
*
- * @param {!Array<!Object>} states A list of network state information for
- * each favorite network.
+ * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states
+ * A list of network state information for each favorite network.
*/
var onFavoriteNetworksReceived = function(states) {
createStateTable('favorite-state-table', FAVORITE_STATE_FIELDS, states);

Powered by Google App Engine
This is Rietveld 408576698