| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{Name: string, Type: string, servicePath: string}} | 8 * @typedef {{Name: string, Type: string, servicePath: string}} |
| 9 */ | 9 */ |
| 10 options.PreferredNetwork; | 10 options.PreferredNetwork; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 * @param {options.PreferredNetwork} entry | 119 * @param {options.PreferredNetwork} entry |
| 120 */ | 120 */ |
| 121 createItem: function(entry) { | 121 createItem: function(entry) { |
| 122 return new PreferredNetworkListItem(entry); | 122 return new PreferredNetworkListItem(entry); |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 /** @override */ | 125 /** @override */ |
| 126 deleteItemAtIndex: function(index) { | 126 deleteItemAtIndex: function(index) { |
| 127 var item = this.dataModel.item(index); | 127 var item = this.dataModel.item(index); |
| 128 if (item) { | 128 if (item) { |
| 129 // Inform the network library that we are forgetting this network. | 129 // TODO(stevenjb): Add removeNetwork to chrome.networkingPrivate and |
| 130 chrome.send('networkCommand', | 130 // use that here. |
| 131 [item.Type, | 131 chrome.send('removeNetwork', [item.servicePath]); |
| 132 item.servicePath, | |
| 133 'forget']); | |
| 134 } | 132 } |
| 135 this.dataModel.splice(index, 1); | 133 this.dataModel.splice(index, 1); |
| 136 // Invalidate the list since it has a stale cache after a splice | 134 // Invalidate the list since it has a stale cache after a splice |
| 137 // involving a deletion. | 135 // involving a deletion. |
| 138 this.invalidate(); | 136 this.invalidate(); |
| 139 this.redraw(); | 137 this.redraw(); |
| 140 }, | 138 }, |
| 141 | 139 |
| 142 /** | 140 /** |
| 143 * Purges all networks from the list. | 141 * Purges all networks from the list. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 155 this.dataModel.push(data); | 153 this.dataModel.push(data); |
| 156 } | 154 } |
| 157 }; | 155 }; |
| 158 | 156 |
| 159 // Export | 157 // Export |
| 160 return { | 158 return { |
| 161 PreferredNetworks: PreferredNetworks | 159 PreferredNetworks: PreferredNetworks |
| 162 }; | 160 }; |
| 163 | 161 |
| 164 }); | 162 }); |
| OLD | NEW |