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