Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / options / chromeos / preferred_networks.js
index 02bc709..8dd24ec 100644 (file)
@@ -2,6 +2,13 @@
 // 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;
@@ -16,9 +23,10 @@ cr.define('options', function() {
   /**
    * 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);
@@ -47,9 +55,9 @@ cr.define('options', function() {
 
   /**
    * 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');
@@ -66,7 +74,7 @@ cr.define('options', function() {
 
     /**
      * Description of the network.
-     * @type {{Name: string, Type: string, servicePath: string}}
+     * @type {?options.PreferredNetwork}
      */
     data: null,
 
@@ -106,7 +114,10 @@ cr.define('options', function() {
       this.selectionModel.unselectAll();
     },
 
-    /** @override */
+    /**
+     * @override
+     * @param {options.PreferredNetwork} entry
+     */
     createItem: function(entry) {
       return new PreferredNetworkListItem(entry);
     },
@@ -115,11 +126,9 @@ cr.define('options', function() {
     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
@@ -138,8 +147,7 @@ cr.define('options', function() {
 
     /**
      * 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);