| 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 var Manager = Polymer({ | 6 var Manager = Polymer({ |
| 7 is: 'downloads-manager', | 7 is: 'downloads-manager', |
| 8 | 8 |
| 9 properties: { | 9 properties: { |
| 10 hasDownloads_: { | 10 hasDownloads_: { |
| 11 type: Boolean, | 11 type: Boolean, |
| 12 value: false, | 12 value: false, |
| 13 }, | 13 }, |
| 14 | 14 |
| 15 items_: { | 15 items_: { |
| 16 type: Array, | 16 type: Array, |
| 17 }, | 17 }, |
| 18 }, | 18 }, |
| 19 | 19 |
| 20 hostAttributes: { |
| 21 loading: true, |
| 22 }, |
| 23 |
| 20 /** | 24 /** |
| 21 * @param {Event} e | 25 * @param {Event} e |
| 22 * @private | 26 * @private |
| 23 */ | 27 */ |
| 24 onCanExecute_: function(e) { | 28 onCanExecute_: function(e) { |
| 25 e = /** @type {cr.ui.CanExecuteEvent} */(e); | 29 e = /** @type {cr.ui.CanExecuteEvent} */(e); |
| 26 switch (e.command.id) { | 30 switch (e.command.id) { |
| 27 case 'undo-command': | 31 case 'undo-command': |
| 28 e.canExecute = this.$.toolbar.canUndo(); | 32 e.canExecute = this.$.toolbar.canUndo(); |
| 29 break; | 33 break; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 var isSearching = downloads.ActionService.getInstance().isSearching(); | 96 var isSearching = downloads.ActionService.getInstance().isSearching(); |
| 93 var messageToShow = isSearching ? 'noSearchResults' : 'noDownloads'; | 97 var messageToShow = isSearching ? 'noSearchResults' : 'noDownloads'; |
| 94 this.$['no-downloads'].querySelector('span').textContent = | 98 this.$['no-downloads'].querySelector('span').textContent = |
| 95 loadTimeData.getString(messageToShow); | 99 loadTimeData.getString(messageToShow); |
| 96 } | 100 } |
| 97 this.hasDownloads_ = hasDownloads; | 101 this.hasDownloads_ = hasDownloads; |
| 98 | 102 |
| 99 if (loadTimeData.getBoolean('allowDeletingHistory')) | 103 if (loadTimeData.getBoolean('allowDeletingHistory')) |
| 100 this.$.toolbar.downloadsShowing = this.hasDownloads_; | 104 this.$.toolbar.downloadsShowing = this.hasDownloads_; |
| 101 | 105 |
| 102 this.$.panel.classList.remove('loading'); | 106 this.removeAttribute('loading'); |
| 103 }, | 107 }, |
| 104 | 108 |
| 105 /** | 109 /** |
| 106 * @param {!downloads.Data} data | 110 * @param {!downloads.Data} data |
| 107 * @private | 111 * @private |
| 108 */ | 112 */ |
| 109 updateItem_: function(data) { | 113 updateItem_: function(data) { |
| 110 var index = this.idToIndex_[data.id]; | 114 var index = this.idToIndex_[data.id]; |
| 111 this.set('items_.' + index, data); | 115 this.set('items_.' + index, data); |
| 112 this.$['downloads-list'].updateSizeForItem(index); | 116 this.$['downloads-list'].updateSizeForItem(index); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 124 Manager.updateItem = function(item) { | 128 Manager.updateItem = function(item) { |
| 125 document.querySelector('downloads-manager').updateItem_(item); | 129 document.querySelector('downloads-manager').updateItem_(item); |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 Manager.onLoad = function() { | 132 Manager.onLoad = function() { |
| 129 document.querySelector('downloads-manager').onLoad_(); | 133 document.querySelector('downloads-manager').onLoad_(); |
| 130 }; | 134 }; |
| 131 | 135 |
| 132 return {Manager: Manager}; | 136 return {Manager: Manager}; |
| 133 }); | 137 }); |
| OLD | NEW |