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