| 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 }, |
| 66 }, | 75 }, |
| 67 | 76 |
| 68 /** | 77 /** |
| 69 * Changes the toolbar background color depending on whether any history items | 78 * Changes the toolbar background color depending on whether any history items |
| 70 * are currently selected. | 79 * are currently selected. |
| 71 * @private | 80 * @private |
| 72 */ | 81 */ |
| 73 changeToolbarView_: function() { | 82 changeToolbarView_: function() { |
| 74 this.itemsSelected_ = this.count > 0; | 83 this.itemsSelected_ = this.count > 0; |
| 75 }, | 84 }, |
| 76 | 85 |
| 77 /** | 86 /** |
| 78 * When changing the search term externally, update the search field to | 87 * When changing the search term externally, update the search field to |
| 79 * reflect the new search term. | 88 * reflect the new search term. |
| 80 * @param {string} search | 89 * @param {string} search |
| 81 */ | 90 */ |
| 82 setSearchTerm: function(search) { | 91 setSearchTerm: function(search) { |
| 83 if (this.searchTerm == search) | 92 if (this.searchTerm == search) |
| 84 return; | 93 return; |
| 85 | 94 |
| 86 this.searchTerm = search; | 95 this.searchTerm = search; |
| 87 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) | 96 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) |
| 88 .getSearchField(); | 97 .getSearchField(); |
| 89 searchField.showAndFocus(); | 98 searchField.showAndFocus(); |
| 90 searchField.setValue(search); | 99 searchField.setValue(search); |
| 91 }, | 100 }, |
| 92 | 101 |
| 102 /** @private */ |
| 103 onMenuPromoShown_: function() { |
| 104 md_history.BrowserService.getInstance().menuPromoShown(); |
| 105 }, |
| 106 |
| 93 /** | 107 /** |
| 94 * @param {!CustomEvent} event | 108 * @param {!CustomEvent} event |
| 95 * @private | 109 * @private |
| 96 */ | 110 */ |
| 97 onSearchChanged_: function(event) { | 111 onSearchChanged_: function(event) { |
| 98 this.searchTerm = /** @type {string} */ (event.detail); | 112 this.searchTerm = /** @type {string} */ (event.detail); |
| 99 }, | 113 }, |
| 100 | 114 |
| 101 /** @private */ | 115 /** @private */ |
| 102 onInfoButtonTap_: function() { | 116 onInfoButtonTap_: function() { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // TODO(calamity): Fix the format of these dates. | 157 // TODO(calamity): Fix the format of these dates. |
| 144 return loadTimeData.getStringF( | 158 return loadTimeData.getStringF( |
| 145 'historyInterval', queryStartTime, queryEndTime); | 159 'historyInterval', queryStartTime, queryEndTime); |
| 146 }, | 160 }, |
| 147 | 161 |
| 148 /** @private */ | 162 /** @private */ |
| 149 hasDrawerChanged_: function() { | 163 hasDrawerChanged_: function() { |
| 150 this.updateStyles(); | 164 this.updateStyles(); |
| 151 }, | 165 }, |
| 152 }); | 166 }); |
| OLD | NEW |