Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 | 80 |
| 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 this.searchTerm = search; | 89 this.searchTerm = search; |
| 90 var searchField = /** @type {SearchField} */(this.$['search-input']); | 90 var toolbar = /** @type {CrToolbarElement} */(this.$['main-toolbar']); |
|
dpapad
2016/05/18 23:39:13
Is toolbar expected to be null after this line? If
tsergeant
2016/05/19 07:11:55
Closure comment: Done.
Ack on the comment about r
| |
| 91 searchField.showAndFocus().then(function(showing) { | 91 toolbar.showAndFocus().then(function(showing) { |
| 92 if (showing) searchField.setValue(search); | 92 if (showing) toolbar.setValue(search); |
| 93 }); | 93 }); |
| 94 }, | 94 }, |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * If the search term has changed reload for the new search. | 97 * If the search term has changed reload for the new search. |
| 98 */ | 98 */ |
| 99 onSearch: function(searchTerm) { | 99 onSearch: function(searchTerm) { |
| 100 if (searchTerm != this.searchTerm) { | 100 if (searchTerm != this.searchTerm) { |
| 101 this.searchTerm = searchTerm; | 101 this.searchTerm = searchTerm; |
| 102 this.fire('search-changed', {search: searchTerm}); | 102 this.fire('search-changed', {search: searchTerm}); |
| 103 } | 103 } |
| 104 }, | 104 }, |
| 105 | 105 |
| 106 attached: function() { | 106 attached: function() { |
| 107 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this); | 107 this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this); |
| 108 /** @type {SearchField} */(this.$['search-input']) | 108 /** @type {CrToolbarElement} */(this.$['main-toolbar']) |
|
dpapad
2016/05/18 23:39:13
Nit: !CrToolbarElement
tsergeant
2016/05/19 07:11:55
Done.
| |
| 109 .setDelegate(this.searchFieldDelegate_); | 109 .setDelegate(this.searchFieldDelegate_); |
| 110 }, | 110 }, |
| 111 | 111 |
| 112 onClearSelectionTap_: function() { | 112 onClearSelectionTap_: function() { |
| 113 this.fire('unselect-all'); | 113 this.fire('unselect-all'); |
| 114 }, | 114 }, |
| 115 | 115 |
| 116 onDeleteTap_: function() { | 116 onDeleteTap_: function() { |
| 117 this.fire('delete-selected'); | 117 this.fire('delete-selected'); |
| 118 }, | 118 }, |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * If the user is a supervised user the delete button is not shown. | 121 * If the user is a supervised user the delete button is not shown. |
| 122 * @private | 122 * @private |
| 123 */ | 123 */ |
| 124 deletingAllowed_: function() { | 124 deletingAllowed_: function() { |
| 125 return loadTimeData.getBoolean('allowDeletingHistory'); | 125 return loadTimeData.getBoolean('allowDeletingHistory'); |
| 126 }, | 126 }, |
| 127 | 127 |
| 128 numberOfItemsSelected_: function(count) { | 128 numberOfItemsSelected_: function(count) { |
| 129 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; | 129 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; |
| 130 }, | 130 }, |
| 131 | 131 |
| 132 getHistoryInterval_: function(queryStartTime, queryEndTime) { | 132 getHistoryInterval_: function(queryStartTime, queryEndTime) { |
| 133 // TODO(calamity): Fix the format of these dates. | 133 // TODO(calamity): Fix the format of these dates. |
| 134 return loadTimeData.getStringF( | 134 return loadTimeData.getStringF( |
| 135 'historyInterval', queryStartTime, queryEndTime); | 135 'historyInterval', queryStartTime, queryEndTime); |
| 136 } | 136 } |
| 137 }); | 137 }); |
| OLD | NEW |