| 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 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 pause: chromeSendWithId('pause'), | 2243 pause: chromeSendWithId('pause'), |
| 2244 remove: chromeSendWithId('remove'), | 2244 remove: chromeSendWithId('remove'), |
| 2245 resume: chromeSendWithId('resume'), | 2245 resume: chromeSendWithId('resume'), |
| 2246 saveDangerous: chromeSendWithId('saveDangerous'), | 2246 saveDangerous: chromeSendWithId('saveDangerous'), |
| 2247 search: function(searchText) { | 2247 search: function(searchText) { |
| 2248 var searchTerms = ActionService.splitTerms(searchText); | 2248 var searchTerms = ActionService.splitTerms(searchText); |
| 2249 var sameTerms = searchTerms.length == this.searchTerms_.length; | 2249 var sameTerms = searchTerms.length == this.searchTerms_.length; |
| 2250 for (var i = 0; sameTerms && i < searchTerms.length; ++i) { | 2250 for (var i = 0; sameTerms && i < searchTerms.length; ++i) { |
| 2251 if (searchTerms[i] != this.searchTerms_[i]) sameTerms = false; | 2251 if (searchTerms[i] != this.searchTerms_[i]) sameTerms = false; |
| 2252 } | 2252 } |
| 2253 if (sameTerms) return; | 2253 if (sameTerms) return false; |
| 2254 this.searchTerms_ = searchTerms; | 2254 this.searchTerms_ = searchTerms; |
| 2255 this.loadMore(); | 2255 this.loadMore(); |
| 2256 return true; |
| 2256 }, | 2257 }, |
| 2257 show: chromeSendWithId('show'), | 2258 show: chromeSendWithId('show'), |
| 2258 undo: chrome.send.bind(chrome, 'undo') | 2259 undo: chrome.send.bind(chrome, 'undo') |
| 2259 }; | 2260 }; |
| 2260 cr.addSingletonGetter(ActionService); | 2261 cr.addSingletonGetter(ActionService); |
| 2261 return { | 2262 return { |
| 2262 ActionService: ActionService | 2263 ActionService: ActionService |
| 2263 }; | 2264 }; |
| 2264 }); | 2265 }); |
| 2265 | 2266 |
| (...skipping 4529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6795 this.$.more.restoreFocusOnClose = false; | 6796 this.$.more.restoreFocusOnClose = false; |
| 6796 this.closeMoreActions_(); | 6797 this.closeMoreActions_(); |
| 6797 this.$.more.restoreFocusOnClose = true; | 6798 this.$.more.restoreFocusOnClose = true; |
| 6798 }, | 6799 }, |
| 6799 onPaperDropdownOpen_: function() { | 6800 onPaperDropdownOpen_: function() { |
| 6800 this.boundClose_ = this.boundClose_ || this.closeMoreActions_.bind(this); | 6801 this.boundClose_ = this.boundClose_ || this.closeMoreActions_.bind(this); |
| 6801 window.addEventListener('resize', this.boundClose_); | 6802 window.addEventListener('resize', this.boundClose_); |
| 6802 }, | 6803 }, |
| 6803 onSearchChanged_: function(event) { | 6804 onSearchChanged_: function(event) { |
| 6804 var actionService = downloads.ActionService.getInstance(); | 6805 var actionService = downloads.ActionService.getInstance(); |
| 6805 actionService.search(event.detail); | 6806 if (actionService.search(event.detail)) this.spinnerActive = actionService
.isSearching(); |
| 6806 this.spinnerActive = actionService.isSearching(); | |
| 6807 this.updateClearAll_(); | 6807 this.updateClearAll_(); |
| 6808 }, | 6808 }, |
| 6809 onOpenDownloadsFolderTap_: function() { | 6809 onOpenDownloadsFolderTap_: function() { |
| 6810 downloads.ActionService.getInstance().openDownloadsFolder(); | 6810 downloads.ActionService.getInstance().openDownloadsFolder(); |
| 6811 }, | 6811 }, |
| 6812 updateClearAll_: function() { | 6812 updateClearAll_: function() { |
| 6813 this.$$('paper-menu .clear-all').hidden = !this.canClearAll(); | 6813 this.$$('paper-menu .clear-all').hidden = !this.canClearAll(); |
| 6814 } | 6814 } |
| 6815 }); | 6815 }); |
| 6816 return { | 6816 return { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6940 }; | 6940 }; |
| 6941 return { | 6941 return { |
| 6942 Manager: Manager | 6942 Manager: Manager |
| 6943 }; | 6943 }; |
| 6944 }); | 6944 }); |
| 6945 | 6945 |
| 6946 // Copyright 2015 The Chromium Authors. All rights reserved. | 6946 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 6947 // Use of this source code is governed by a BSD-style license that can be | 6947 // Use of this source code is governed by a BSD-style license that can be |
| 6948 // found in the LICENSE file. | 6948 // found in the LICENSE file. |
| 6949 window.addEventListener('load', downloads.Manager.onLoad); | 6949 window.addEventListener('load', downloads.Manager.onLoad); |
| OLD | NEW |