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

Side by Side Diff: chrome/browser/resources/md_downloads/toolbar.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 Toolbar = Polymer({ 6 var Toolbar = Polymer({
7 is: 'downloads-toolbar', 7 is: 'downloads-toolbar',
8 8
9 attached: function() { 9 attached: function() {
10 // isRTL() only works after i18n_template.js runs to set <html dir>. 10 // isRTL() only works after i18n_template.js runs to set <html dir>.
11 this.overflowAlign_ = isRTL() ? 'left' : 'right'; 11 this.overflowAlign_ = isRTL() ? 'left' : 'right';
12 12
13 /** @private {!SearchFieldDelegate} */ 13 /** @private {!SearchFieldDelegate} */
14 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this); 14 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this);
15 this.$['search-input'].setDelegate(this.searchFieldDelegate_); 15 this.$['search-input'].setDelegate(this.searchFieldDelegate_);
16 }, 16 },
17 17
18 properties: { 18 properties: {
19 downloadsShowing: { 19 downloadsShowing: {
20 reflectToAttribute: true, 20 reflectToAttribute: true,
21 type: Boolean, 21 type: Boolean,
22 value: false, 22 value: false,
23 observer: 'onDownloadsShowingChange_', 23 observer: 'downloadsShowingChanged_',
24 }, 24 },
25 25
26 overflowAlign_: { 26 overflowAlign_: {
27 type: String, 27 type: String,
28 value: 'right', 28 value: 'right',
29 }, 29 },
30 }, 30 },
31 31
32 /** @return {boolean} Whether removal can be undone. */ 32 /** @return {boolean} Whether removal can be undone. */
33 canUndo: function() { 33 canUndo: function() {
34 return this.$['search-input'] != this.shadowRoot.activeElement; 34 return this.$['search-input'] != this.shadowRoot.activeElement;
35 }, 35 },
36 36
37 /** @return {boolean} Whether "Clear all" should be allowed. */ 37 /** @return {boolean} Whether "Clear all" should be allowed. */
38 canClearAll: function() { 38 canClearAll: function() {
39 return !this.$['search-input'].getValue() && this.downloadsShowing; 39 return !this.$['search-input'].getValue() && this.downloadsShowing;
40 }, 40 },
41 41
42 onFindCommand: function() {
43 this.$['search-input'].showAndFocus();
44 },
45
42 /** @private */ 46 /** @private */
43 onClearAllTap_: function() { 47 onClearAllTap_: function() {
44 assert(this.canClearAll()); 48 assert(this.canClearAll());
45 downloads.ActionService.getInstance().clearAll(); 49 downloads.ActionService.getInstance().clearAll();
46 }, 50 },
47 51
48 /** @private */ 52 /** @private */
49 onDownloadsShowingChange_: function() { 53 downloadsShowingChanged_: function() {
50 this.updateClearAll_(); 54 this.updateClearAll_();
51 }, 55 },
52 56
53 /** @param {string} searchTerm */ 57 /** @param {string} searchTerm */
54 onSearchTermSearch: function(searchTerm) { 58 onSearchTermSearch: function(searchTerm) {
55 downloads.ActionService.getInstance().search(searchTerm); 59 downloads.ActionService.getInstance().search(searchTerm);
56 this.updateClearAll_(); 60 this.updateClearAll_();
57 }, 61 },
58 62
59 /** @private */ 63 /** @private */
(...skipping 27 matching lines...) Expand all
87 }; 91 };
88 92
89 return {Toolbar: Toolbar}; 93 return {Toolbar: Toolbar};
90 }); 94 });
91 95
92 // TODO(dbeam): https://github.com/PolymerElements/iron-dropdown/pull/16/files 96 // TODO(dbeam): https://github.com/PolymerElements/iron-dropdown/pull/16/files
93 /** @suppress {checkTypes} */ 97 /** @suppress {checkTypes} */
94 (function() { 98 (function() {
95 Polymer.IronDropdownScrollManager.pushScrollLock = function() {}; 99 Polymer.IronDropdownScrollManager.pushScrollLock = function() {};
96 })(); 100 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698