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

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

Issue 1613233003: MD Downloads: make Ctrl+f invoke in-page search (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dl-vulcanize
Patch Set: rework, revulc Created 4 years, 11 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_: {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 */ 72 */
73 onCanExecute_: function(e) { 73 onCanExecute_: function(e) {
74 e = /** @type {cr.ui.CanExecuteEvent} */(e); 74 e = /** @type {cr.ui.CanExecuteEvent} */(e);
75 switch (e.command.id) { 75 switch (e.command.id) {
76 case 'undo-command': 76 case 'undo-command':
77 e.canExecute = this.$.toolbar.canUndo(); 77 e.canExecute = this.$.toolbar.canUndo();
78 break; 78 break;
79 case 'clear-all-command': 79 case 'clear-all-command':
80 e.canExecute = this.$.toolbar.canClearAll(); 80 e.canExecute = this.$.toolbar.canClearAll();
81 break; 81 break;
82 case 'find-command':
83 e.canExecute = true;
84 break;
82 } 85 }
83 }, 86 },
84 87
85 /** 88 /**
86 * @param {Event} e 89 * @param {Event} e
87 * @private 90 * @private
88 */ 91 */
89 onCommand_: function(e) { 92 onCommand_: function(e) {
90 if (e.command.id == 'clear-all-command') 93 if (e.command.id == 'clear-all-command')
91 downloads.ActionService.getInstance().clearAll(); 94 downloads.ActionService.getInstance().clearAll();
92 else if (e.command.id == 'undo-command') 95 else if (e.command.id == 'undo-command')
93 downloads.ActionService.getInstance().undo(); 96 downloads.ActionService.getInstance().undo();
97 else if (e.command.id == 'find-command')
98 this.$.toolbar.onFindCommand();
94 }, 99 },
95 100
96 /** @private */ 101 /** @private */
97 onListScroll_: function() { 102 onListScroll_: function() {
98 var list = this.$['downloads-list']; 103 var list = this.$['downloads-list'];
99 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) { 104 if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) {
100 // Approaching the end of the scrollback. Attempt to load more items. 105 // Approaching the end of the scrollback. Attempt to load more items.
101 downloads.ActionService.getInstance().loadMore(); 106 downloads.ActionService.getInstance().loadMore();
102 } 107 }
103 }, 108 },
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 Manager.removeItem = function(index) { 174 Manager.removeItem = function(index) {
170 Manager.get().removeItem_(index); 175 Manager.get().removeItem_(index);
171 }; 176 };
172 177
173 Manager.updateItem = function(index, data) { 178 Manager.updateItem = function(index, data) {
174 Manager.get().updateItem_(index, data); 179 Manager.get().updateItem_(index, data);
175 }; 180 };
176 181
177 return {Manager: Manager}; 182 return {Manager: Manager};
178 }); 183 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698