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

Side by Side Diff: chrome/browser/resources/md_history/history_toolbar.js

Issue 2057353002: WebUI: cr-search-field, do not call delegate if search query did not change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments. Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/test/data/webui/cr_elements/cr_toolbar_search_field_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {SearchFieldDelegate} 7 * @implements {SearchFieldDelegate}
8 * @param {!HistoryToolbarElement} toolbar This history-toolbar. 8 * @param {!HistoryToolbarElement} toolbar This history-toolbar.
9 */ 9 */
10 function ToolbarSearchFieldDelegate(toolbar) { 10 function ToolbarSearchFieldDelegate(toolbar) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return; 90 return;
91 91
92 this.searchTerm = search; 92 this.searchTerm = search;
93 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) 93 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar'])
94 .getSearchField(); 94 .getSearchField();
95 searchField.showAndFocus(); 95 searchField.showAndFocus();
96 searchField.setValue(search); 96 searchField.setValue(search);
97 }, 97 },
98 98
99 /** 99 /**
100 * If the search term has changed reload for the new search. 100 * @param {string} searchTerm
101 */ 101 */
102 onSearch: function(searchTerm) { 102 onSearch: function(searchTerm) {
103 if (searchTerm != this.searchTerm) 103 this.searchTerm = searchTerm;
104 this.searchTerm = searchTerm;
105 }, 104 },
106 105
107 attached: function() { 106 attached: function() {
108 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this); 107 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this);
109 /** @type {!CrToolbarElement} */(this.$['main-toolbar']).getSearchField() 108 /** @type {!CrToolbarElement} */(this.$['main-toolbar']).getSearchField()
110 .setDelegate(this.searchFieldDelegate_); 109 .setDelegate(this.searchFieldDelegate_);
111 }, 110 },
112 111
113 onClearSelectionTap_: function() { 112 onClearSelectionTap_: function() {
114 this.fire('unselect-all'); 113 this.fire('unselect-all');
(...skipping 14 matching lines...) Expand all
129 numberOfItemsSelected_: function(count) { 128 numberOfItemsSelected_: function(count) {
130 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; 129 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : '';
131 }, 130 },
132 131
133 getHistoryInterval_: function(queryStartTime, queryEndTime) { 132 getHistoryInterval_: function(queryStartTime, queryEndTime) {
134 // TODO(calamity): Fix the format of these dates. 133 // TODO(calamity): Fix the format of these dates.
135 return loadTimeData.getStringF( 134 return loadTimeData.getStringF(
136 'historyInterval', queryStartTime, queryEndTime); 135 'historyInterval', queryStartTime, queryEndTime);
137 } 136 }
138 }); 137 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/cr_elements/cr_toolbar_search_field_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698