Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: chrome/browser/resources/md_downloads/manager.js

Issue 2344893006: MD Downloads: add "waterfall" shadow (shows when the list is scrolled) (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 observer: 'hasDownloadsChanged_', 11 observer: 'hasDownloadsChanged_',
12 type: Boolean, 12 type: Boolean,
13 }, 13 },
14 14
15 hasShadow_: {
16 type: Boolean,
17 value: false,
18 reflectToAttribute: true,
19 },
20
15 items_: { 21 items_: {
16 type: Array, 22 type: Array,
17 value: function() { return []; }, 23 value: function() { return []; },
18 }, 24 },
19 25
20 spinnerActive_: { 26 spinnerActive_: {
21 type: Boolean, 27 type: Boolean,
22 notify: true, 28 notify: true,
23 }, 29 },
24 }, 30 },
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 this.$.toolbar.onFindCommand(); 110 this.$.toolbar.onFindCommand();
105 }, 111 },
106 112
107 /** @private */ 113 /** @private */
108 onListScroll_: function() { 114 onListScroll_: function() {
109 var list = this.$['downloads-list']; 115 var list = this.$['downloads-list'];
110 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { 116 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) {
111 // Approaching the end of the scrollback. Attempt to load more items. 117 // Approaching the end of the scrollback. Attempt to load more items.
112 downloads.ActionService.getInstance().loadMore(); 118 downloads.ActionService.getInstance().loadMore();
113 } 119 }
120 this.hasShadow_ = list.scrollTop > 0;
114 }, 121 },
115 122
116 /** @private */ 123 /** @private */
117 onLoad_: function() { 124 onLoad_: function() {
118 cr.ui.decorate('command', cr.ui.Command); 125 cr.ui.decorate('command', cr.ui.Command);
119 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); 126 document.addEventListener('canExecute', this.onCanExecute_.bind(this));
120 document.addEventListener('command', this.onCommand_.bind(this)); 127 document.addEventListener('command', this.onCommand_.bind(this));
121 128
122 downloads.ActionService.getInstance().loadMore(); 129 downloads.ActionService.getInstance().loadMore();
123 }, 130 },
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 Manager.removeItem = function(index) { 188 Manager.removeItem = function(index) {
182 Manager.get().removeItem_(index); 189 Manager.get().removeItem_(index);
183 }; 190 };
184 191
185 Manager.updateItem = function(index, data) { 192 Manager.updateItem = function(index, data) {
186 Manager.get().updateItem_(index, data); 193 Manager.get().updateItem_(index, data);
187 }; 194 };
188 195
189 return {Manager: Manager}; 196 return {Manager: Manager};
190 }); 197 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698