| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.browser_options', function() { | 5 cr.define('options.browser_options', function() { |
| 6 const List = cr.ui.List; | 6 const DeletableItemList = options.DeletableItemList; |
| 7 const ListItem = cr.ui.ListItem; | 7 const ListItem = cr.ui.ListItem; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Creates a new startup page list item. | 10 * Creates a new startup page list item. |
| 11 * @param {Object} pageInfo The page this item represents. | 11 * @param {Object} pageInfo The page this item represents. |
| 12 * @constructor | 12 * @constructor |
| 13 * @extends {cr.ui.ListItem} | 13 * @extends {cr.ui.ListItem} |
| 14 */ | 14 */ |
| 15 function StartupPageListItem(pageInfo) { | 15 function StartupPageListItem(pageInfo) { |
| 16 var el = cr.doc.createElement('div'); | 16 var el = cr.doc.createElement('div'); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 43 this.pageInfo_['url']); | 43 this.pageInfo_['url']); |
| 44 titleEl.title = this.pageInfo_['tooltip']; | 44 titleEl.title = this.pageInfo_['tooltip']; |
| 45 | 45 |
| 46 this.appendChild(titleEl); | 46 this.appendChild(titleEl); |
| 47 }, | 47 }, |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 var StartupPageList = cr.ui.define('list'); | 50 var StartupPageList = cr.ui.define('list'); |
| 51 | 51 |
| 52 StartupPageList.prototype = { | 52 StartupPageList.prototype = { |
| 53 __proto__: List.prototype, | 53 __proto__: DeletableItemList.prototype, |
| 54 | 54 |
| 55 /** @inheritDoc */ | 55 /** @inheritDoc */ |
| 56 createItem: function(pageInfo) { | 56 createItemContents: function(pageInfo) { |
| 57 return new StartupPageListItem(pageInfo); | 57 return new StartupPageListItem(pageInfo); |
| 58 }, | 58 }, |
| 59 |
| 60 /** @inheritDoc */ |
| 61 deleteItem: function(pageInfo) { |
| 62 var index = this.dataModel.indexOf(pageInfo); |
| 63 chrome.send('removeStartupPages', [String(index)]); |
| 64 }, |
| 59 }; | 65 }; |
| 60 | 66 |
| 61 return { | 67 return { |
| 62 StartupPageList: StartupPageList | 68 StartupPageList: StartupPageList |
| 63 }; | 69 }; |
| 64 }); | 70 }); |
| OLD | NEW |