// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+cr.exportPath('options');
+
+/**
+ * @typedef {{Name: string, Type: string, servicePath: string}}
+ */
+options.PreferredNetwork;
+
cr.define('options', function() {
var Page = cr.ui.pageManager.Page;
/**
* Encapsulated handling of ChromeOS network preferences page.
* @constructor
+ * @extends {cr.ui.pageManager.Page}
*/
function PreferredNetworks(model) {
- Page.call(this, 'preferredNetworksPage', null, 'preferredNetworksPage');
+ Page.call(this, 'preferredNetworksPage', '', 'preferredNetworksPage');
}
cr.addSingletonGetter(PreferredNetworks);
/**
* Creates a list entry for a remembered network.
- * @param {{Name: string, Type: string, servicePath: string}} data
- * Description of the network.
+ * @param {options.PreferredNetwork} data Description of the network.
* @constructor
+ * @extends {options.DeletableItem}
*/
function PreferredNetworkListItem(data) {
var el = cr.doc.createElement('div');
/**
* Description of the network.
- * @type {{Name: string, Type: string, servicePath: string}}
+ * @type {?options.PreferredNetwork}
*/
data: null,
this.selectionModel.unselectAll();
},
- /** @override */
+ /**
+ * @override
+ * @param {options.PreferredNetwork} entry
+ */
createItem: function(entry) {
return new PreferredNetworkListItem(entry);
},
deleteItemAtIndex: function(index) {
var item = this.dataModel.item(index);
if (item) {
- // Inform the network library that we are forgetting this network.
- chrome.send('networkCommand',
- [item.Type,
- item.servicePath,
- 'forget']);
+ // TODO(stevenjb): Add removeNetwork to chrome.networkingPrivate and
+ // use that here.
+ chrome.send('removeNetwork', [item.servicePath]);
}
this.dataModel.splice(index, 1);
// Invalidate the list since it has a stale cache after a splice
/**
* Adds a remembered network to the list.
- * @param {{Name: string, Type: string, servicePath: string}} data
- * Description of the network.
+ * @param {options.PreferredNetwork} data Description of the network.
*/
append: function(data) {
this.dataModel.push(data);