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

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

Issue 5685003: DOMUI Prefs: Add a deletable item list type, and use it for startup pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits fixed Created 10 years 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) 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
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 deleteItemAtIndex: function(index) {
62 chrome.send('removeStartupPages', [String(index)]);
63 },
59 }; 64 };
60 65
61 return { 66 return {
62 StartupPageList: StartupPageList 67 StartupPageList: StartupPageList
63 }; 68 };
64 }); 69 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/browser_options.js ('k') | chrome/browser/resources/options/deletable_item_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698