Chromium Code Reviews| 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.define('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 var Page = cr.ui.pageManager.Page; | 7 var Page = cr.ui.pageManager.Page; |
| 8 var PageManager = cr.ui.pageManager.PageManager; | 8 var PageManager = cr.ui.pageManager.PageManager; |
| 9 var ArrayDataModel = cr.ui.ArrayDataModel; | 9 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 10 var DeletableItem = options.DeletableItem; | 10 var DeletableItem = options.DeletableItem; |
| 11 var DeletableItemList = options.DeletableItemList; | 11 var DeletableItemList = options.DeletableItemList; |
| 12 | 12 |
| 13 ///////////////////////////////////////////////////////////////////////////// | 13 ///////////////////////////////////////////////////////////////////////////// |
| 14 // NetworkPreferences class: | 14 // NetworkPreferences class: |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Encapsulated handling of ChromeOS network preferences page. | 17 * Encapsulated handling of ChromeOS network preferences page. |
| 18 * @constructor | 18 * @constructor |
| 19 * @extends {cr.ui.pageManager.Page} | 19 * @extends {cr.ui.pageManager.Page} |
| 20 */ | 20 */ |
| 21 function PreferredNetworks(model) { | 21 function PreferredNetworks(model) { |
| 22 Page.call(this, 'preferredNetworksPage', null, 'preferredNetworksPage'); | 22 Page.call(this, 'preferredNetworksPage', '', 'preferredNetworksPage'); |
| 23 } | 23 } |
| 24 | 24 |
| 25 cr.addSingletonGetter(PreferredNetworks); | 25 cr.addSingletonGetter(PreferredNetworks); |
| 26 | 26 |
| 27 PreferredNetworks.prototype = { | 27 PreferredNetworks.prototype = { |
| 28 __proto__: Page.prototype, | 28 __proto__: Page.prototype, |
| 29 | 29 |
| 30 /** @override */ | 30 /** @override */ |
| 31 initializePage: function() { | 31 initializePage: function() { |
| 32 Page.prototype.initializePage.call(this); | 32 Page.prototype.initializePage.call(this); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 61 el.data[key] = data[key]; | 61 el.data[key] = data[key]; |
| 62 el.decorate(); | 62 el.decorate(); |
| 63 return el; | 63 return el; |
| 64 } | 64 } |
| 65 | 65 |
| 66 PreferredNetworkListItem.prototype = { | 66 PreferredNetworkListItem.prototype = { |
| 67 __proto__: DeletableItem.prototype, | 67 __proto__: DeletableItem.prototype, |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Description of the network. | 70 * Description of the network. |
| 71 * @type {{Name: string, Type: string, servicePath: string}} | 71 * @type {?{Name: string, Type: string, servicePath: string}} |
|
Dan Beam
2014/09/12 03:25:20
@typedef
Vitaly Pavlenko
2014/09/12 19:16:23
Done.
| |
| 72 */ | 72 */ |
| 73 data: null, | 73 data: null, |
| 74 | 74 |
| 75 /** @override */ | 75 /** @override */ |
| 76 decorate: function() { | 76 decorate: function() { |
| 77 DeletableItem.prototype.decorate.call(this); | 77 DeletableItem.prototype.decorate.call(this); |
| 78 var label = this.ownerDocument.createElement('div'); | 78 var label = this.ownerDocument.createElement('div'); |
| 79 label.textContent = this.data.Name; | 79 label.textContent = this.data.Name; |
| 80 if (this.data.policyManaged) | 80 if (this.data.policyManaged) |
| 81 this.deletable = false; | 81 this.deletable = false; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * When the list loses focus, unselect all items in the list. | 104 * When the list loses focus, unselect all items in the list. |
| 105 * @private | 105 * @private |
| 106 */ | 106 */ |
| 107 onBlur_: function() { | 107 onBlur_: function() { |
| 108 this.selectionModel.unselectAll(); | 108 this.selectionModel.unselectAll(); |
| 109 }, | 109 }, |
| 110 | 110 |
| 111 /** @override */ | 111 /** |
| 112 * @override | |
| 113 * @param {{Name: string, Type: string, servicePath: string}} entry | |
| 114 */ | |
| 112 createItem: function(entry) { | 115 createItem: function(entry) { |
| 113 return new PreferredNetworkListItem(entry); | 116 return new PreferredNetworkListItem(entry); |
| 114 }, | 117 }, |
| 115 | 118 |
| 116 /** @override */ | 119 /** @override */ |
| 117 deleteItemAtIndex: function(index) { | 120 deleteItemAtIndex: function(index) { |
| 118 var item = this.dataModel.item(index); | 121 var item = this.dataModel.item(index); |
| 119 if (item) { | 122 if (item) { |
| 120 // Inform the network library that we are forgetting this network. | 123 // Inform the network library that we are forgetting this network. |
| 121 chrome.send('networkCommand', | 124 chrome.send('networkCommand', |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 147 this.dataModel.push(data); | 150 this.dataModel.push(data); |
| 148 } | 151 } |
| 149 }; | 152 }; |
| 150 | 153 |
| 151 // Export | 154 // Export |
| 152 return { | 155 return { |
| 153 PreferredNetworks: PreferredNetworks | 156 PreferredNetworks: PreferredNetworks |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 }); | 159 }); |
| OLD | NEW |