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, GUID: string}} |
9 */ | 9 */ |
10 options.PreferredNetwork; | 10 options.PreferredNetwork; |
11 | 11 |
12 cr.define('options', function() { | 12 cr.define('options', function() { |
13 | 13 |
14 var Page = cr.ui.pageManager.Page; | 14 var Page = cr.ui.pageManager.Page; |
15 var PageManager = cr.ui.pageManager.PageManager; | 15 var PageManager = cr.ui.pageManager.PageManager; |
16 var ArrayDataModel = cr.ui.ArrayDataModel; | 16 var ArrayDataModel = cr.ui.ArrayDataModel; |
17 var DeletableItem = options.DeletableItem; | 17 var DeletableItem = options.DeletableItem; |
18 var DeletableItemList = options.DeletableItemList; | 18 var DeletableItemList = options.DeletableItemList; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // TODO(stevenjb): Add removeNetwork to chrome.networkingPrivate and | 129 // TODO(stevenjb): Add removeNetwork to chrome.networkingPrivate and |
130 // use that here. | 130 // use that here. |
131 chrome.send('removeNetwork', [item.servicePath]); | 131 chrome.send('removeNetwork', [item.GUID]); |
132 } | 132 } |
133 this.dataModel.splice(index, 1); | 133 this.dataModel.splice(index, 1); |
134 // 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 |
135 // involving a deletion. | 135 // involving a deletion. |
136 this.invalidate(); | 136 this.invalidate(); |
137 this.redraw(); | 137 this.redraw(); |
138 }, | 138 }, |
139 | 139 |
140 /** | 140 /** |
141 * Purges all networks from the list. | 141 * Purges all networks from the list. |
(...skipping 11 matching lines...) Expand all Loading... |
153 this.dataModel.push(data); | 153 this.dataModel.push(data); |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 // Export | 157 // Export |
158 return { | 158 return { |
159 PreferredNetworks: PreferredNetworks | 159 PreferredNetworks: PreferredNetworks |
160 }; | 160 }; |
161 | 161 |
162 }); | 162 }); |
OLD | NEW |