| 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 Polymer({ | 5 Polymer({ |
| 6 is: 'history-toolbar', | 6 is: 'history-toolbar', |
| 7 properties: { | 7 properties: { |
| 8 // Number of history items currently selected. | 8 // Number of history items currently selected. |
| 9 // TODO(calamity): bind this to | 9 // TODO(calamity): bind this to |
| 10 // listContainer.selectedItem.selectedPaths.length. | 10 // listContainer.selectedItem.selectedPaths.length. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 value: 0, | 56 value: 0, |
| 57 reflectToAttribute: true, | 57 reflectToAttribute: true, |
| 58 notify: true | 58 notify: true |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 // The start time of the query range. | 61 // The start time of the query range. |
| 62 queryStartTime: String, | 62 queryStartTime: String, |
| 63 | 63 |
| 64 // The end time of the query range. | 64 // The end time of the query range. |
| 65 queryEndTime: String, | 65 queryEndTime: String, |
| 66 | |
| 67 // Whether to show the menu promo (a tooltip that points at the menu button | |
| 68 // in narrow mode). | |
| 69 showMenuPromo_: { | |
| 70 type: Boolean, | |
| 71 value: function() { | |
| 72 return loadTimeData.getBoolean('showMenuPromo'); | |
| 73 }, | |
| 74 }, | |
| 75 }, | 66 }, |
| 76 | 67 |
| 77 /** | 68 /** |
| 78 * Changes the toolbar background color depending on whether any history items | 69 * Changes the toolbar background color depending on whether any history items |
| 79 * are currently selected. | 70 * are currently selected. |
| 80 * @private | 71 * @private |
| 81 */ | 72 */ |
| 82 changeToolbarView_: function() { | 73 changeToolbarView_: function() { |
| 83 this.itemsSelected_ = this.count > 0; | 74 this.itemsSelected_ = this.count > 0; |
| 84 }, | 75 }, |
| 85 | 76 |
| 86 /** | 77 /** |
| 87 * When changing the search term externally, update the search field to | 78 * When changing the search term externally, update the search field to |
| 88 * reflect the new search term. | 79 * reflect the new search term. |
| 89 * @param {string} search | 80 * @param {string} search |
| 90 */ | 81 */ |
| 91 setSearchTerm: function(search) { | 82 setSearchTerm: function(search) { |
| 92 if (this.searchTerm == search) | 83 if (this.searchTerm == search) |
| 93 return; | 84 return; |
| 94 | 85 |
| 95 this.searchTerm = search; | 86 this.searchTerm = search; |
| 96 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) | 87 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) |
| 97 .getSearchField(); | 88 .getSearchField(); |
| 98 searchField.showAndFocus(); | 89 searchField.showAndFocus(); |
| 99 searchField.setValue(search); | 90 searchField.setValue(search); |
| 100 }, | 91 }, |
| 101 | 92 |
| 102 /** @private */ | |
| 103 onMenuPromoShown_: function() { | |
| 104 md_history.BrowserService.getInstance().menuPromoShown(); | |
| 105 }, | |
| 106 | |
| 107 /** | 93 /** |
| 108 * @param {!CustomEvent} event | 94 * @param {!CustomEvent} event |
| 109 * @private | 95 * @private |
| 110 */ | 96 */ |
| 111 onSearchChanged_: function(event) { | 97 onSearchChanged_: function(event) { |
| 112 this.searchTerm = /** @type {string} */ (event.detail); | 98 this.searchTerm = /** @type {string} */ (event.detail); |
| 113 }, | 99 }, |
| 114 | 100 |
| 115 /** @private */ | 101 /** @private */ |
| 116 onInfoButtonTap_: function() { | 102 onInfoButtonTap_: function() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // TODO(calamity): Fix the format of these dates. | 142 // TODO(calamity): Fix the format of these dates. |
| 157 return loadTimeData.getStringF( | 143 return loadTimeData.getStringF( |
| 158 'historyInterval', queryStartTime, queryEndTime); | 144 'historyInterval', queryStartTime, queryEndTime); |
| 159 }, | 145 }, |
| 160 | 146 |
| 161 /** @private */ | 147 /** @private */ |
| 162 hasDrawerChanged_: function() { | 148 hasDrawerChanged_: function() { |
| 163 this.updateStyles(); | 149 this.updateStyles(); |
| 164 }, | 150 }, |
| 165 }); | 151 }); |
| OLD | NEW |