OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 function assert(condition, opt_message) { | 4 function assert(condition, opt_message) { |
5 if (!condition) { | 5 if (!condition) { |
6 var message = 'Assertion failed'; | 6 var message = 'Assertion failed'; |
7 if (opt_message) message = message + ': ' + opt_message; | 7 if (opt_message) message = message + ': ' + opt_message; |
8 var error = new Error(message); | 8 var error = new Error(message); |
9 var global = function() { | 9 var global = function() { |
10 return this; | 10 return this; |
(...skipping 6849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6860 // Use of this source code is governed by a BSD-style license that can be | 6860 // Use of this source code is governed by a BSD-style license that can be |
6861 // found in the LICENSE file. | 6861 // found in the LICENSE file. |
6862 cr.define('downloads', function() { | 6862 cr.define('downloads', function() { |
6863 var Manager = Polymer({ | 6863 var Manager = Polymer({ |
6864 is: 'downloads-manager', | 6864 is: 'downloads-manager', |
6865 properties: { | 6865 properties: { |
6866 hasDownloads_: { | 6866 hasDownloads_: { |
6867 observer: 'hasDownloadsChanged_', | 6867 observer: 'hasDownloadsChanged_', |
6868 type: Boolean | 6868 type: Boolean |
6869 }, | 6869 }, |
| 6870 hasShadow_: { |
| 6871 type: Boolean, |
| 6872 value: false, |
| 6873 reflectToAttribute: true |
| 6874 }, |
6870 items_: { | 6875 items_: { |
6871 type: Array, | 6876 type: Array, |
6872 value: function() { | 6877 value: function() { |
6873 return []; | 6878 return []; |
6874 } | 6879 } |
6875 }, | 6880 }, |
6876 spinnerActive_: { | 6881 spinnerActive_: { |
6877 type: Boolean, | 6882 type: Boolean, |
6878 notify: true | 6883 notify: true |
6879 } | 6884 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6924 } | 6929 } |
6925 }, | 6930 }, |
6926 onCommand_: function(e) { | 6931 onCommand_: function(e) { |
6927 if (e.command.id == 'clear-all-command') downloads.ActionService.getInstan
ce().clearAll(); else if (e.command.id == 'undo-command') downloads.ActionServic
e.getInstance().undo(); else if (e.command.id == 'find-command') this.$.toolbar.
onFindCommand(); | 6932 if (e.command.id == 'clear-all-command') downloads.ActionService.getInstan
ce().clearAll(); else if (e.command.id == 'undo-command') downloads.ActionServic
e.getInstance().undo(); else if (e.command.id == 'find-command') this.$.toolbar.
onFindCommand(); |
6928 }, | 6933 }, |
6929 onListScroll_: function() { | 6934 onListScroll_: function() { |
6930 var list = this.$['downloads-list']; | 6935 var list = this.$['downloads-list']; |
6931 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { | 6936 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { |
6932 downloads.ActionService.getInstance().loadMore(); | 6937 downloads.ActionService.getInstance().loadMore(); |
6933 } | 6938 } |
| 6939 this.hasShadow_ = list.scrollTop > 0; |
6934 }, | 6940 }, |
6935 onLoad_: function() { | 6941 onLoad_: function() { |
6936 cr.ui.decorate('command', cr.ui.Command); | 6942 cr.ui.decorate('command', cr.ui.Command); |
6937 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); | 6943 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); |
6938 document.addEventListener('command', this.onCommand_.bind(this)); | 6944 document.addEventListener('command', this.onCommand_.bind(this)); |
6939 downloads.ActionService.getInstance().loadMore(); | 6945 downloads.ActionService.getInstance().loadMore(); |
6940 }, | 6946 }, |
6941 removeItem_: function(index) { | 6947 removeItem_: function(index) { |
6942 this.splice('items_', index, 1); | 6948 this.splice('items_', index, 1); |
6943 this.updateHideDates_(index, index); | 6949 this.updateHideDates_(index, index); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6978 }; | 6984 }; |
6979 return { | 6985 return { |
6980 Manager: Manager | 6986 Manager: Manager |
6981 }; | 6987 }; |
6982 }); | 6988 }); |
6983 | 6989 |
6984 // Copyright 2015 The Chromium Authors. All rights reserved. | 6990 // Copyright 2015 The Chromium Authors. All rights reserved. |
6985 // Use of this source code is governed by a BSD-style license that can be | 6991 // Use of this source code is governed by a BSD-style license that can be |
6986 // found in the LICENSE file. | 6992 // found in the LICENSE file. |
6987 window.addEventListener('load', downloads.Manager.onLoad); | 6993 window.addEventListener('load', downloads.Manager.onLoad); |
OLD | NEW |