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