Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Side by Side Diff: chrome/browser/resources/options/chromeos/preferred_networks.js

Issue 426723004: options: Remove a bunch of useless: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 var ArrayDataModel = cr.ui.ArrayDataModel; 8 var ArrayDataModel = cr.ui.ArrayDataModel;
9 var DeletableItem = options.DeletableItem; 9 var DeletableItem = options.DeletableItem;
10 var DeletableItemList = options.DeletableItemList; 10 var DeletableItemList = options.DeletableItemList;
(...skipping 10 matching lines...) Expand all
21 'preferredNetworksPage', 21 'preferredNetworksPage',
22 null, 22 null,
23 'preferredNetworksPage'); 23 'preferredNetworksPage');
24 } 24 }
25 25
26 cr.addSingletonGetter(PreferredNetworks); 26 cr.addSingletonGetter(PreferredNetworks);
27 27
28 PreferredNetworks.prototype = { 28 PreferredNetworks.prototype = {
29 __proto__: OptionsPage.prototype, 29 __proto__: OptionsPage.prototype,
30 30
31 /** 31 /** @override */
32 * Initializes the preferred networks page.
33 */
34 initializePage: function() { 32 initializePage: function() {
35 OptionsPage.prototype.initializePage.call(this); 33 OptionsPage.prototype.initializePage.call(this);
36 PreferredNetworkList.decorate($('remembered-network-list')); 34 PreferredNetworkList.decorate($('remembered-network-list'));
37 $('preferred-networks-confirm').onclick = 35 $('preferred-networks-confirm').onclick =
38 OptionsPage.closeOverlay.bind(OptionsPage); 36 OptionsPage.closeOverlay.bind(OptionsPage);
39 }, 37 },
40 38
41 update: function(rememberedNetworks) { 39 update: function(rememberedNetworks) {
42 var list = $('remembered-network-list'); 40 var list = $('remembered-network-list');
43 list.clear(); 41 list.clear();
44 for (var i = 0; i < rememberedNetworks.length; i++) { 42 for (var i = 0; i < rememberedNetworks.length; i++) {
45 list.append(rememberedNetworks[i]); 43 list.append(rememberedNetworks[i]);
46 } 44 }
47 list.redraw(); 45 list.redraw();
48 } 46 }
49 47
50 }; 48 };
51 49
52 /** 50 /**
53 * Creates a list entry for a remembered network. 51 * Creates a list entry for a remembered network.
54 * @param{{Name: string, 52 * @param {{Name: string, Type: string, servicePath: string}} data
55 Type: string, 53 * Description of the network.
56 servicePath: string}} data
57 * Description of the network.
58 * @constructor 54 * @constructor
59 */ 55 */
60 function PreferredNetworkListItem(data) { 56 function PreferredNetworkListItem(data) {
61 var el = cr.doc.createElement('div'); 57 var el = cr.doc.createElement('div');
62 el.__proto__ = PreferredNetworkListItem.prototype; 58 el.__proto__ = PreferredNetworkListItem.prototype;
63 el.data = {}; 59 el.data = {};
64 for (var key in data) 60 for (var key in data)
65 el.data[key] = data[key]; 61 el.data[key] = data[key];
66 el.decorate(); 62 el.decorate();
67 return el; 63 return el;
68 } 64 }
69 65
70 PreferredNetworkListItem.prototype = { 66 PreferredNetworkListItem.prototype = {
71 __proto__: DeletableItem.prototype, 67 __proto__: DeletableItem.prototype,
72 68
73 /** 69 /**
74 * Description of the network. 70 * Description of the network.
75 * @type {{Name: string, 71 * @type {{Name: string, Type: string, servicePath: string}}
76 * Type: string,
77 * servicePath: string}}
78 */ 72 */
79 data: null, 73 data: null,
80 74
81 /** @override */ 75 /** @override */
82 decorate: function() { 76 decorate: function() {
83 DeletableItem.prototype.decorate.call(this); 77 DeletableItem.prototype.decorate.call(this);
84 var label = this.ownerDocument.createElement('div'); 78 var label = this.ownerDocument.createElement('div');
85 label.textContent = this.data.Name; 79 label.textContent = this.data.Name;
86 if (this.data.policyManaged) 80 if (this.data.policyManaged)
87 this.deletable = false; 81 this.deletable = false;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 /** 133 /**
140 * Purges all networks from the list. 134 * Purges all networks from the list.
141 */ 135 */
142 clear: function() { 136 clear: function() {
143 this.dataModel = new ArrayDataModel([]); 137 this.dataModel = new ArrayDataModel([]);
144 this.redraw(); 138 this.redraw();
145 }, 139 },
146 140
147 /** 141 /**
148 * Adds a remembered network to the list. 142 * Adds a remembered network to the list.
149 * @param {{Name: string, 143 * @param {{Name: string, Type: string, servicePath: string}} data
150 Type: string,
151 servicePath: string} data
152 * Description of the network. 144 * Description of the network.
153 */ 145 */
154 append: function(data) { 146 append: function(data) {
155 this.dataModel.push(data); 147 this.dataModel.push(data);
156 } 148 }
157 }; 149 };
158 150
159 // Export 151 // Export
160 return { 152 return {
161 PreferredNetworks: PreferredNetworks 153 PreferredNetworks: PreferredNetworks
162 }; 154 };
163 155
164 }); 156 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698