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_: { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 * @param {Event} e | 86 * @param {Event} e |
87 * @private | 87 * @private |
88 */ | 88 */ |
89 onCommand_: function(e) { | 89 onCommand_: function(e) { |
90 if (e.command.id == 'clear-all-command') | 90 if (e.command.id == 'clear-all-command') |
91 downloads.ActionService.getInstance().clearAll(); | 91 downloads.ActionService.getInstance().clearAll(); |
92 else if (e.command.id == 'undo-command') | 92 else if (e.command.id == 'undo-command') |
93 downloads.ActionService.getInstance().undo(); | 93 downloads.ActionService.getInstance().undo(); |
94 }, | 94 }, |
95 | 95 |
96 /** | 96 /** @private */ |
97 * @param {Event} e | 97 onListScroll_: function() { |
98 * @private | |
99 */ | |
100 onListScroll_: function(e) { | |
101 var list = this.$['downloads-list']; | 98 var list = this.$['downloads-list']; |
102 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { | 99 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { |
103 // Approaching the end of the scrollback. Attempt to load more items. | 100 // Approaching the end of the scrollback. Attempt to load more items. |
104 downloads.ActionService.getInstance().loadMore(); | 101 downloads.ActionService.getInstance().loadMore(); |
105 } | 102 } |
106 }, | 103 }, |
107 | 104 |
108 /** @private */ | 105 /** @private */ |
109 onLoad_: function() { | 106 onLoad_: function() { |
110 cr.ui.decorate('command', cr.ui.Command); | 107 cr.ui.decorate('command', cr.ui.Command); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 Manager.removeItem = function(index) { | 169 Manager.removeItem = function(index) { |
173 Manager.get().removeItem_(index); | 170 Manager.get().removeItem_(index); |
174 }; | 171 }; |
175 | 172 |
176 Manager.updateItem = function(index, data) { | 173 Manager.updateItem = function(index, data) { |
177 Manager.get().updateItem_(index, data); | 174 Manager.get().updateItem_(index, data); |
178 }; | 175 }; |
179 | 176 |
180 return {Manager: Manager}; | 177 return {Manager: Manager}; |
181 }); | 178 }); |
OLD | NEW |