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

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

Issue 2004263002: [Do not commit] MD History: Experimentally implement cr-toolbar using cr-search-field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 /** 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 /** 81 /**
82 * When changing the search term externally, update the search field to 82 * When changing the search term externally, update the search field to
83 * reflect the new search term. 83 * reflect the new search term.
84 * @param {string} search 84 * @param {string} search
85 */ 85 */
86 setSearchTerm: function(search) { 86 setSearchTerm: function(search) {
87 if (this.searchTerm == search) 87 if (this.searchTerm == search)
88 return; 88 return;
89 89
90 this.searchTerm = search; 90 this.searchTerm = search;
91 var searchField = /** @type {SearchField} */(this.$['search-input']); 91 var toolbar = /** @type {!CrToolbarElement} */(this.$['main-toolbar']);
92 searchField.showAndFocus().then(function(showing) { 92 //toolbar.showAndFocus().then(function(showing) {
93 if (showing) searchField.setValue(search); 93 //if (showing) toolbar.setValue(search);
94 }); 94 //});
95 }, 95 },
96 96
97 /** 97 /**
98 * If the search term has changed reload for the new search. 98 * If the search term has changed reload for the new search.
99 */ 99 */
100 onSearch: function(searchTerm) { 100 onSearch: function(searchTerm) {
101 if (searchTerm != this.searchTerm) 101 if (searchTerm != this.searchTerm)
102 this.searchTerm = searchTerm; 102 this.searchTerm = searchTerm;
103 }, 103 },
104 104
105 attached: function() { 105 attached: function() {
106 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this); 106 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this);
107 /** @type {SearchField} */(this.$['search-input']) 107 /** @type {!CrToolbarElement} */(this.$['main-toolbar'])
108 .setDelegate(this.searchFieldDelegate_); 108 //.setDelegate(this.searchFieldDelegate_);
109 }, 109 },
110 110
111 onClearSelectionTap_: function() { 111 onClearSelectionTap_: function() {
112 this.fire('unselect-all'); 112 this.fire('unselect-all');
113 }, 113 },
114 114
115 onDeleteTap_: function() { 115 onDeleteTap_: function() {
116 this.fire('delete-selected'); 116 this.fire('delete-selected');
117 }, 117 },
118 118
119 /** 119 /**
120 * If the user is a supervised user the delete button is not shown. 120 * If the user is a supervised user the delete button is not shown.
121 * @private 121 * @private
122 */ 122 */
123 deletingAllowed_: function() { 123 deletingAllowed_: function() {
124 return loadTimeData.getBoolean('allowDeletingHistory'); 124 return loadTimeData.getBoolean('allowDeletingHistory');
125 }, 125 },
126 126
127 numberOfItemsSelected_: function(count) { 127 numberOfItemsSelected_: function(count) {
128 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; 128 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : '';
129 }, 129 },
130 130
131 getHistoryInterval_: function(queryStartTime, queryEndTime) { 131 getHistoryInterval_: function(queryStartTime, queryEndTime) {
132 // TODO(calamity): Fix the format of these dates. 132 // TODO(calamity): Fix the format of these dates.
133 return loadTimeData.getStringF( 133 return loadTimeData.getStringF(
134 'historyInterval', queryStartTime, queryEndTime); 134 'historyInterval', queryStartTime, queryEndTime);
135 } 135 }
136 }); 136 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698