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

Side by Side Diff: chrome/browser/resources/options/handler_options_list.js

Issue 560563004: Compile chrome://settings, part 5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_make_public
Patch Set: fixed assert errors Created 6 years, 3 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
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 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
7 /** @const */ var List = cr.ui.List; 7 /** @const */ var List = cr.ui.List;
8 /** @const */ var ListItem = cr.ui.ListItem; 8 /** @const */ var ListItem = cr.ui.ListItem;
9 /** @const */ var DeletableItem = options.DeletableItem; 9 /** @const */ var DeletableItem = options.DeletableItem;
10 /** @const */ var DeletableItemList = options.DeletableItemList; 10 /** @const */ var DeletableItemList = options.DeletableItemList;
11 11
12 /** 12 /**
13 * Creates a new ignored protocol / content handler list item. 13 * Creates a new ignored protocol / content handler list item.
14 * 14 *
15 * Accepts values in the form 15 * Accepts values in the form
16 * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'], 16 * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'],
17 * @param {Object} entry A dictionary describing the handlers for a given 17 * @param {Object} entry A dictionary describing the handlers for a given
18 * protocol. 18 * protocol.
19 * @constructor 19 * @constructor
20 * @extends {options.DeletableItemList} 20 * @extends {options.DeletableItem}
21 */ 21 */
22 function IgnoredHandlersListItem(entry) { 22 function IgnoredHandlersListItem(entry) {
23 var el = cr.doc.createElement('div'); 23 var el = cr.doc.createElement('div');
24 el.dataItem = entry; 24 el.dataItem = entry;
25 el.__proto__ = IgnoredHandlersListItem.prototype; 25 el.__proto__ = IgnoredHandlersListItem.prototype;
26 el.decorate(); 26 el.decorate();
27 return el; 27 return el;
28 } 28 }
29 29
30 IgnoredHandlersListItem.prototype = { 30 IgnoredHandlersListItem.prototype = {
(...skipping 11 matching lines...) Expand all
42 42
43 // Host name. 43 // Host name.
44 var hostElement = document.createElement('div'); 44 var hostElement = document.createElement('div');
45 hostElement.textContent = this.dataItem[2]; 45 hostElement.textContent = this.dataItem[2];
46 hostElement.className = 'handlers-site-column'; 46 hostElement.className = 'handlers-site-column';
47 hostElement.title = this.dataItem[1]; 47 hostElement.title = this.dataItem[1];
48 this.contentElement_.appendChild(hostElement); 48 this.contentElement_.appendChild(hostElement);
49 }, 49 },
50 }; 50 };
51 51
52 52 /**
53 * @constructor
54 * @extends {options.DeletableItemList}
55 */
53 var IgnoredHandlersList = cr.ui.define('list'); 56 var IgnoredHandlersList = cr.ui.define('list');
54 57
55 IgnoredHandlersList.prototype = { 58 IgnoredHandlersList.prototype = {
56 __proto__: DeletableItemList.prototype, 59 __proto__: DeletableItemList.prototype,
57 60
58 createItem: function(entry) { 61 createItem: function(entry) {
59 return new IgnoredHandlersListItem(entry); 62 return new IgnoredHandlersListItem(entry);
60 }, 63 },
61 64
62 deleteItemAtIndex: function(index) { 65 deleteItemAtIndex: function(index) {
(...skipping 12 matching lines...) Expand all
75 * IgnoredHandlersListItem for an example of the format the list should 78 * IgnoredHandlersListItem for an example of the format the list should
76 * take. 79 * take.
77 * 80 *
78 * @param {Object} list A list of ignored protocol handlers. 81 * @param {Object} list A list of ignored protocol handlers.
79 */ 82 */
80 setHandlers: function(list) { 83 setHandlers: function(list) {
81 this.dataModel = new ArrayDataModel(list); 84 this.dataModel = new ArrayDataModel(list);
82 }, 85 },
83 }; 86 };
84 87
85
86
87 /** 88 /**
88 * Creates a new protocol / content handler list item. 89 * Creates a new protocol / content handler list item.
89 * 90 *
90 * Accepts values in the form 91 * Accepts values in the form
91 * { protocol: 'mailto', 92 * { protocol: 'mailto',
92 * handlers: [ 93 * handlers: [
93 * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'], 94 * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'],
94 * ..., 95 * ...,
95 * ], 96 * ],
96 * } 97 * }
97 * @param {Object} entry A dictionary describing the handlers for a given 98 * @param {Object} entry A dictionary describing the handlers for a given
98 * protocol. 99 * protocol.
99 * @constructor 100 * @constructor
100 * @extends {cr.ui.ListItem} 101 * @extends {cr.ui.ListItem}
101 */ 102 */
102 function HandlerListItem(entry) { 103 function HandlerListItem(entry) {
103 var el = cr.doc.createElement('div'); 104 var el = cr.doc.createElement('div');
104 el.dataItem = entry; 105 el.dataItem = entry;
105 el.__proto__ = HandlerListItem.prototype; 106 el.__proto__ = HandlerListItem.prototype;
106 el.decorate(); 107 el.decorate();
107 return el; 108 return el;
108 } 109 }
109 110
110 HandlerListItem.prototype = { 111 HandlerListItem.prototype = {
111 __proto__: ListItem.prototype, 112 __proto__: ListItem.prototype,
112 113
114 /**
115 * @param {Handlers} data
116 * @param {{removeHandler: Function, setDefault: Function,
117 * clearDefault: Function}} delegate
118 */
113 buildWidget_: function(data, delegate) { 119 buildWidget_: function(data, delegate) {
114 // Protocol. 120 // Protocol.
115 var protocolElement = document.createElement('div'); 121 var protocolElement = document.createElement('div');
116 protocolElement.textContent = data.protocol; 122 protocolElement.textContent = data.protocol;
117 protocolElement.className = 'handlers-type-column'; 123 protocolElement.className = 'handlers-type-column';
118 this.appendChild(protocolElement); 124 this.appendChild(protocolElement);
119 125
120 // Handler selection. 126 // Handler selection.
121 var handlerElement = document.createElement('div'); 127 var handlerElement = document.createElement('div');
122 var selectElement = document.createElement('select'); 128 var selectElement = document.createElement('select');
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 /** 222 /**
217 * Create a new passwords list. 223 * Create a new passwords list.
218 * @constructor 224 * @constructor
219 * @extends {cr.ui.List} 225 * @extends {cr.ui.List}
220 */ 226 */
221 var HandlersList = cr.ui.define('list'); 227 var HandlersList = cr.ui.define('list');
222 228
223 HandlersList.prototype = { 229 HandlersList.prototype = {
224 __proto__: List.prototype, 230 __proto__: List.prototype,
225 231
226 /** @override */ 232 /**
233 * @override
234 * @param {Object} entry
235 */
227 createItem: function(entry) { 236 createItem: function(entry) {
228 return new HandlerListItem(entry); 237 return new HandlerListItem(entry);
229 }, 238 },
230 239
231 /** 240 /**
232 * The length of the list. 241 * The length of the list.
233 */ 242 */
234 get length() { 243 get length() {
235 return this.dataModel.length; 244 return this.dataModel.length;
236 }, 245 },
237 246
238 /** 247 /**
239 * Set the protocol handlers displayed by this list. 248 * Set the protocol handlers displayed by this list.
240 * See HandlerListItem for an example of the format the list should take. 249 * See HandlerListItem for an example of the format the list should take.
241 * 250 *
242 * @param {Object} list A list of protocols with their registered handlers. 251 * @param {!Array} list A list of protocols with their registered handlers.
243 */ 252 */
244 setHandlers: function(list) { 253 setHandlers: function(list) {
245 this.dataModel = new ArrayDataModel(list); 254 this.dataModel = new ArrayDataModel(list);
246 }, 255 },
247 }; 256 };
248 257
249 return { 258 return {
250 IgnoredHandlersListItem: IgnoredHandlersListItem, 259 IgnoredHandlersListItem: IgnoredHandlersListItem,
251 IgnoredHandlersList: IgnoredHandlersList, 260 IgnoredHandlersList: IgnoredHandlersList,
252 HandlerListItem: HandlerListItem, 261 HandlerListItem: HandlerListItem,
253 HandlersList: HandlersList, 262 HandlersList: HandlersList,
254 }; 263 };
255 }); 264 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/handler_options.js ('k') | chrome/browser/resources/options/home_page_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698