| 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     created: function() { | 9     created: function() { | 
| 10       /** @private {!downloads.ActionService} */ | 10       /** @private {!downloads.ActionService} */ | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 37      * @param {Event} e | 37      * @param {Event} e | 
| 38      * @private | 38      * @private | 
| 39      */ | 39      */ | 
| 40     onCanExecute_: function(e) { | 40     onCanExecute_: function(e) { | 
| 41       e = /** @type {cr.ui.CanExecuteEvent} */(e); | 41       e = /** @type {cr.ui.CanExecuteEvent} */(e); | 
| 42       switch (e.command.id) { | 42       switch (e.command.id) { | 
| 43         case 'undo-command': | 43         case 'undo-command': | 
| 44           e.canExecute = this.$.toolbar.canUndo(); | 44           e.canExecute = this.$.toolbar.canUndo(); | 
| 45           break; | 45           break; | 
| 46         case 'clear-all-command': | 46         case 'clear-all-command': | 
| 47           e.canExecute = true; | 47           e.canExecute = this.$.toolbar.canClearAll(); | 
| 48           break; | 48           break; | 
| 49       } | 49       } | 
| 50     }, | 50     }, | 
| 51 | 51 | 
| 52     /** | 52     /** | 
| 53      * @param {Event} e | 53      * @param {Event} e | 
| 54      * @private | 54      * @private | 
| 55      */ | 55      */ | 
| 56     onCommand_: function(e) { | 56     onCommand_: function(e) { | 
| 57       if (e.command.id == 'clear-all-command') | 57       if (e.command.id == 'clear-all-command') | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 150           if (this.items_[j].parentNode) | 150           if (this.items_[j].parentNode) | 
| 151             before = this.items_[j]; | 151             before = this.items_[j]; | 
| 152         } | 152         } | 
| 153         // If |before| is null, |item| will just get added at the end. | 153         // If |before| is null, |item| will just get added at the end. | 
| 154         this.$['downloads-list'].insertBefore(item, before); | 154         this.$['downloads-list'].insertBefore(item, before); | 
| 155       } | 155       } | 
| 156 | 156 | 
| 157       this.hasDownloads_ = this.size_() > 0; | 157       this.hasDownloads_ = this.size_() > 0; | 
| 158 | 158 | 
| 159       if (loadTimeData.getBoolean('allowDeletingHistory')) | 159       if (loadTimeData.getBoolean('allowDeletingHistory')) | 
| 160         this.$.toolbar.canClearAll = this.hasDownloads_; | 160         this.$.toolbar.downloadsShowing = this.hasDownloads_; | 
| 161 | 161 | 
| 162       this.onResize_(); | 162       this.onResize_(); | 
| 163     }, | 163     }, | 
| 164 | 164 | 
| 165     /** | 165     /** | 
| 166      * @param {!downloads.Data} data | 166      * @param {!downloads.Data} data | 
| 167      * @private | 167      * @private | 
| 168      */ | 168      */ | 
| 169     updateItem_: function(data) { | 169     updateItem_: function(data) { | 
| 170       this.idMap_[data.id].update(data); | 170       this.idMap_[data.id].update(data); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 185   }; | 185   }; | 
| 186 | 186 | 
| 187   Manager.onLoad = function() { | 187   Manager.onLoad = function() { | 
| 188     document.querySelector('downloads-manager').onLoad_(); | 188     document.querySelector('downloads-manager').onLoad_(); | 
| 189   }; | 189   }; | 
| 190 | 190 | 
| 191   return {Manager: Manager}; | 191   return {Manager: Manager}; | 
| 192 }); | 192 }); | 
| 193 | 193 | 
| 194 window.addEventListener('load', downloads.Manager.onLoad); | 194 window.addEventListener('load', downloads.Manager.onLoad); | 
| OLD | NEW | 
|---|