| 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 /** @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', 'The title of the protocol'], | 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 {cr.ui.DeletableItemList} | 20 * @extends {cr.ui.DeletableItemList} |
| 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 = { |
| 31 __proto__: DeletableItem.prototype, | 31 __proto__: DeletableItem.prototype, |
| 32 | 32 |
| 33 /** @override */ | 33 /** @override */ |
| 34 decorate: function() { | 34 decorate: function() { |
| 35 DeletableItem.prototype.decorate.call(this); | 35 DeletableItem.prototype.decorate.call(this); |
| 36 | 36 |
| 37 // Protocol. | 37 // Protocol. |
| 38 var protocolElement = document.createElement('div'); | 38 var protocolElement = document.createElement('div'); |
| 39 protocolElement.textContent = this.dataItem[0]; | 39 protocolElement.textContent = this.dataItem[0]; |
| 40 protocolElement.className = 'handlers-type-column'; | 40 protocolElement.className = 'handlers-type-column'; |
| 41 this.contentElement_.appendChild(protocolElement); | 41 this.contentElement_.appendChild(protocolElement); |
| 42 | 42 |
| 43 // Site title. | 43 // Host name. |
| 44 var titleElement = document.createElement('div'); | 44 var hostElement = document.createElement('div'); |
| 45 titleElement.textContent = this.dataItem[2]; | 45 hostElement.textContent = this.dataItem[2]; |
| 46 titleElement.className = 'handlers-site-column'; | 46 hostElement.className = 'handlers-site-column'; |
| 47 titleElement.title = this.dataItem[1]; | 47 hostElement.title = this.dataItem[1]; |
| 48 this.contentElement_.appendChild(titleElement); | 48 this.contentElement_.appendChild(hostElement); |
| 49 }, | 49 }, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 | 52 |
| 53 var IgnoredHandlersList = cr.ui.define('list'); | 53 var IgnoredHandlersList = cr.ui.define('list'); |
| 54 | 54 |
| 55 IgnoredHandlersList.prototype = { | 55 IgnoredHandlersList.prototype = { |
| 56 __proto__: DeletableItemList.prototype, | 56 __proto__: DeletableItemList.prototype, |
| 57 | 57 |
| 58 createItem: function(entry) { | 58 createItem: function(entry) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 | 85 |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * Creates a new protocol / content handler list item. | 88 * Creates a new protocol / content handler list item. |
| 89 * | 89 * |
| 90 * Accepts values in the form | 90 * Accepts values in the form |
| 91 * { protocol: 'mailto', | 91 * { protocol: 'mailto', |
| 92 * handlers: [ | 92 * handlers: [ |
| 93 * ['mailto', 'http://www.thesite.com/%s', 'The title of the protocol'], | 93 * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'], |
| 94 * ..., | 94 * ..., |
| 95 * ], | 95 * ], |
| 96 * } | 96 * } |
| 97 * @param {Object} entry A dictionary describing the handlers for a given | 97 * @param {Object} entry A dictionary describing the handlers for a given |
| 98 * protocol. | 98 * protocol. |
| 99 * @constructor | 99 * @constructor |
| 100 * @extends {cr.ui.ListItem} | 100 * @extends {cr.ui.ListItem} |
| 101 */ | 101 */ |
| 102 function HandlerListItem(entry) { | 102 function HandlerListItem(entry) { |
| 103 var el = cr.doc.createElement('div'); | 103 var el = cr.doc.createElement('div'); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 }, | 216 }, |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 return { | 219 return { |
| 220 IgnoredHandlersListItem: IgnoredHandlersListItem, | 220 IgnoredHandlersListItem: IgnoredHandlersListItem, |
| 221 IgnoredHandlersList: IgnoredHandlersList, | 221 IgnoredHandlersList: IgnoredHandlersList, |
| 222 HandlerListItem: HandlerListItem, | 222 HandlerListItem: HandlerListItem, |
| 223 HandlersList: HandlersList, | 223 HandlersList: HandlersList, |
| 224 }; | 224 }; |
| 225 }); | 225 }); |
| OLD | NEW |