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 if (typeof Polymer == 'undefined') | 5 if (typeof Polymer == 'undefined') |
6 Polymer = {dom: 'shadow'}; | 6 Polymer = {dom: 'shadow'}; |
7 else | 7 else |
8 console.error('Polymer is already defined.'); | 8 console.error('Polymer is already defined.'); |
9 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 9 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
10 // Use of this source code is governed by a BSD-style license that can be | 10 // Use of this source code is governed by a BSD-style license that can be |
(...skipping 17037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17048 * @param {Event} e | 17048 * @param {Event} e |
17049 * @private | 17049 * @private |
17050 */ | 17050 */ |
17051 onCommand_: function(e) { | 17051 onCommand_: function(e) { |
17052 if (e.command.id == 'clear-all-command') | 17052 if (e.command.id == 'clear-all-command') |
17053 downloads.ActionService.getInstance().clearAll(); | 17053 downloads.ActionService.getInstance().clearAll(); |
17054 else if (e.command.id == 'undo-command') | 17054 else if (e.command.id == 'undo-command') |
17055 downloads.ActionService.getInstance().undo(); | 17055 downloads.ActionService.getInstance().undo(); |
17056 }, | 17056 }, |
17057 | 17057 |
17058 /** | 17058 /** @private */ |
17059 * @param {Event} e | 17059 onListScroll_: function() { |
17060 * @private | |
17061 */ | |
17062 onListScroll_: function(e) { | |
17063 var list = this.$['downloads-list']; | 17060 var list = this.$['downloads-list']; |
17064 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { | 17061 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { |
17065 // Approaching the end of the scrollback. Attempt to load more items. | 17062 // Approaching the end of the scrollback. Attempt to load more items. |
17066 downloads.ActionService.getInstance().loadMore(); | 17063 downloads.ActionService.getInstance().loadMore(); |
17067 } | 17064 } |
17068 }, | 17065 }, |
17069 | 17066 |
17070 /** @private */ | 17067 /** @private */ |
17071 onLoad_: function() { | 17068 onLoad_: function() { |
17072 cr.ui.decorate('command', cr.ui.Command); | 17069 cr.ui.decorate('command', cr.ui.Command); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17139 Manager.get().updateItem_(index, data); | 17136 Manager.get().updateItem_(index, data); |
17140 }; | 17137 }; |
17141 | 17138 |
17142 return {Manager: Manager}; | 17139 return {Manager: Manager}; |
17143 }); | 17140 }); |
17144 // Copyright 2015 The Chromium Authors. All rights reserved. | 17141 // Copyright 2015 The Chromium Authors. All rights reserved. |
17145 // Use of this source code is governed by a BSD-style license that can be | 17142 // Use of this source code is governed by a BSD-style license that can be |
17146 // found in the LICENSE file. | 17143 // found in the LICENSE file. |
17147 | 17144 |
17148 window.addEventListener('load', downloads.Manager.onLoad); | 17145 window.addEventListener('load', downloads.Manager.onLoad); |
OLD | NEW |