OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 cr.define('downloads', function() { | |
6 /** | |
7 * @param {!Element} root | |
8 * @param {?Node} boundary | |
9 * @constructor | |
10 * @extends {cr.ui.FocusRow} | |
11 */ | |
12 function FocusRow(root, boundary) { | |
13 cr.ui.FocusRow.call(this, root, boundary); | |
14 this.addItems(); | |
15 } | |
16 | |
17 FocusRow.prototype = { | |
18 __proto__: cr.ui.FocusRow.prototype, | |
19 | |
20 addItems: function() { | |
21 this.destroy(); | |
22 | |
23 this.addItem('name-file-link', | |
24 'content.is-active:not(.show-progress):not(.dangerous) #name'); | |
25 assert(this.addItem('name-file-link', '#file-link')); | |
26 assert(this.addItem('url', '#url')); | |
27 this.addItem('show-retry', '#show'); | |
28 this.addItem('show-retry', '#retry'); | |
29 this.addItem('pause-resume', '#pause'); | |
30 this.addItem('pause-resume', '#resume'); | |
31 this.addItem('cancel', '#cancel'); | |
32 this.addItem('controlled-by', '#controlled-by a'); | |
33 this.addItem('danger-remove-discard', '#discard'); | |
34 this.addItem('restore-save', '#save'); | |
35 this.addItem('danger-remove-discard', '#danger-remove'); | |
36 this.addItem('restore-save', '#restore'); | |
37 assert(this.addItem('remove', '#remove')); | |
38 | |
39 // TODO(dbeam): it would be nice to do this asynchronously (so if multiple | |
40 // templates get rendered we only re-add once), but Manager#updateItem_() | |
41 // relies on the DOM being re-rendered synchronously. | |
42 this.eventTracker.add(this.root, 'dom-change', this.addItems.bind(this)); | |
43 }, | |
44 }; | |
45 | |
46 return {FocusRow: FocusRow}; | |
47 }); | |
OLD | NEW |