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.browser_options', function() { | 5 cr.define('options.browser_options', function() { |
6 /** @const */ var AutocompleteList = cr.ui.AutocompleteList; | 6 /** @const */ var AutocompleteList = cr.ui.AutocompleteList; |
7 /** @const */ var InlineEditableItem = options.InlineEditableItem; | 7 /** @const */ var InlineEditableItem = options.InlineEditableItem; |
8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; | 8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
9 | 9 |
10 /** | 10 /** |
11 * Creates a new startup page list item. | 11 * Creates a new startup page list item. |
12 * @param {Object} pageInfo The page this item represents. | 12 * @param {Object} pageInfo The page this item represents. |
13 * @constructor | 13 * @constructor |
14 * @extends {cr.ui.ListItem} | 14 * @extends {options.InlineEditableItem} |
15 */ | 15 */ |
16 function StartupPageListItem(pageInfo) { | 16 function StartupPageListItem(pageInfo) { |
17 var el = cr.doc.createElement('div'); | 17 var el = cr.doc.createElement('div'); |
18 el.pageInfo_ = pageInfo; | 18 el.pageInfo_ = pageInfo; |
19 StartupPageListItem.decorate(el); | 19 StartupPageListItem.decorate(el); |
20 return el; | 20 return el; |
21 } | 21 } |
22 | 22 |
23 /** | 23 /** |
24 * Decorates an element as a startup page list item. | 24 * Decorates an element as a startup page list item. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 titleEl.title = pageInfo.tooltip; | 61 titleEl.title = pageInfo.tooltip; |
62 } | 62 } |
63 | 63 |
64 this.contentElement.appendChild(titleEl); | 64 this.contentElement.appendChild(titleEl); |
65 | 65 |
66 var urlEl = this.createEditableTextCell(pageInfo.url); | 66 var urlEl = this.createEditableTextCell(pageInfo.url); |
67 urlEl.className = 'url'; | 67 urlEl.className = 'url'; |
68 urlEl.classList.add('weakrtl'); | 68 urlEl.classList.add('weakrtl'); |
69 this.contentElement.appendChild(urlEl); | 69 this.contentElement.appendChild(urlEl); |
70 | 70 |
71 var urlField = urlEl.querySelector('input'); | 71 var urlField = /** @type {HTMLElement} */(urlEl.querySelector('input')); |
72 urlField.className = 'weakrtl'; | 72 urlField.className = 'weakrtl'; |
73 urlField.placeholder = loadTimeData.getString('startupPagesPlaceholder'); | 73 urlField.placeholder = loadTimeData.getString('startupPagesPlaceholder'); |
74 this.urlField_ = urlField; | 74 this.urlField_ = urlField; |
75 | 75 |
76 this.addEventListener('commitedit', this.onEditCommitted_); | 76 this.addEventListener('commitedit', this.onEditCommitted_); |
77 | 77 |
78 var self = this; | 78 var self = this; |
79 urlField.addEventListener('focus', function(event) { | 79 urlField.addEventListener('focus', function(event) { |
80 self.parentNode.autocompleteList.attachToInput(urlField); | 80 self.parentNode.autocompleteList.attachToInput(urlField); |
81 }); | 81 }); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 this.hideDropMarkerTimer_ = window.setTimeout(function() { | 312 this.hideDropMarkerTimer_ = window.setTimeout(function() { |
313 $('startupPagesListDropmarker').style.display = ''; | 313 $('startupPagesListDropmarker').style.display = ''; |
314 }, 100); | 314 }, 100); |
315 }, | 315 }, |
316 }; | 316 }; |
317 | 317 |
318 return { | 318 return { |
319 StartupPageList: StartupPageList | 319 StartupPageList: StartupPageList |
320 }; | 320 }; |
321 }); | 321 }); |
OLD | NEW |