| 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. |
| 11 count: {type: Number, value: 0, observer: 'changeToolbarView_'}, | 11 count: { |
| 12 type: Number, |
| 13 value: 0, |
| 14 observer: 'changeToolbarView_', |
| 15 }, |
| 12 | 16 |
| 13 // True if 1 or more history items are selected. When this value changes | 17 // True if 1 or more history items are selected. When this value changes |
| 14 // the background colour changes. | 18 // the background colour changes. |
| 15 itemsSelected_: {type: Boolean, value: false, reflectToAttribute: true}, | 19 itemsSelected_: { |
| 20 type: Boolean, |
| 21 value: false, |
| 22 reflectToAttribute: true, |
| 23 }, |
| 16 | 24 |
| 17 // The most recent term entered in the search field. Updated incrementally | 25 // The most recent term entered in the search field. Updated incrementally |
| 18 // as the user types. | 26 // as the user types. |
| 19 searchTerm: { | 27 searchTerm: { |
| 20 type: String, | 28 type: String, |
| 21 observer: 'searchTermChanged_', | 29 observer: 'searchTermChanged_', |
| 22 notify: true, | 30 notify: true, |
| 23 }, | 31 }, |
| 24 | 32 |
| 25 // True if the backend is processing and a spinner should be shown in the | 33 // True if the backend is processing and a spinner should be shown in the |
| 26 // toolbar. | 34 // toolbar. |
| 27 spinnerActive: {type: Boolean, value: false}, | 35 spinnerActive: { |
| 36 type: Boolean, |
| 37 value: false, |
| 38 }, |
| 28 | 39 |
| 29 hasDrawer: { | 40 hasDrawer: { |
| 30 type: Boolean, | 41 type: Boolean, |
| 31 reflectToAttribute: true, | 42 reflectToAttribute: true, |
| 32 }, | 43 }, |
| 33 | 44 |
| 34 showSyncNotice: Boolean, | |
| 35 | |
| 36 // Whether domain-grouped history is enabled. | 45 // Whether domain-grouped history is enabled. |
| 37 isGroupedMode: { | 46 isGroupedMode: { |
| 38 type: Boolean, | 47 type: Boolean, |
| 39 reflectToAttribute: true, | 48 reflectToAttribute: true, |
| 40 }, | 49 }, |
| 41 | 50 |
| 42 // The period to search over. Matches BrowsingHistoryHandler::Range. | 51 // The period to search over. Matches BrowsingHistoryHandler::Range. |
| 43 groupedRange: { | 52 groupedRange: { |
| 44 type: Number, | 53 type: Number, |
| 45 reflectToAttribute: true, | 54 reflectToAttribute: true, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 | 66 |
| 58 // The start time of the query range. | 67 // The start time of the query range. |
| 59 queryStartTime: String, | 68 queryStartTime: String, |
| 60 | 69 |
| 61 // The end time of the query range. | 70 // The end time of the query range. |
| 62 queryEndTime: String, | 71 queryEndTime: String, |
| 63 | 72 |
| 64 // Whether to show the menu promo (a tooltip that points at the menu button | 73 // Whether to show the menu promo (a tooltip that points at the menu button |
| 65 // in narrow mode). | 74 // in narrow mode). |
| 66 showMenuPromo: Boolean, | 75 showMenuPromo: Boolean, |
| 76 |
| 77 showSyncNotice: Boolean, |
| 67 }, | 78 }, |
| 68 | 79 |
| 69 /** @return {CrToolbarSearchFieldElement} */ | 80 /** @return {CrToolbarSearchFieldElement} */ |
| 70 get searchField() { | 81 get searchField() { |
| 71 return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) | 82 return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) |
| 72 .getSearchField(); | 83 .getSearchField(); |
| 73 }, | 84 }, |
| 74 | 85 |
| 75 showSearchField: function() { this.searchField.showAndFocus(); }, | 86 showSearchField: function() { this.searchField.showAndFocus(); }, |
| 76 | 87 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 138 |
| 128 /** @private */ | 139 /** @private */ |
| 129 numberOfItemsSelected_: function(count) { | 140 numberOfItemsSelected_: function(count) { |
| 130 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; | 141 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; |
| 131 }, | 142 }, |
| 132 | 143 |
| 133 /** @private */ | 144 /** @private */ |
| 134 getHistoryInterval_: function(queryStartTime, queryEndTime) { | 145 getHistoryInterval_: function(queryStartTime, queryEndTime) { |
| 135 // TODO(calamity): Fix the format of these dates. | 146 // TODO(calamity): Fix the format of these dates. |
| 136 return loadTimeData.getStringF( | 147 return loadTimeData.getStringF( |
| 137 'historyInterval', queryStartTime, queryEndTime); | 148 'historyInterval', queryStartTime, queryEndTime); |
| 138 }, | 149 }, |
| 139 | 150 |
| 140 /** @private */ | 151 /** @private */ |
| 141 onTodayTap_: function() { | 152 onTodayTap_: function() { |
| 142 if (!this.querying) | 153 if (!this.querying) |
| 143 this.groupedOffset = 0; | 154 this.groupedOffset = 0; |
| 144 }, | 155 }, |
| 145 | 156 |
| 146 /** @private */ | 157 /** @private */ |
| 147 onPrevTap_: function() { | 158 onPrevTap_: function() { |
| 148 if (!this.querying) | 159 if (!this.querying) |
| 149 this.groupedOffset = this.groupedOffset + 1; | 160 this.groupedOffset = this.groupedOffset + 1; |
| 150 }, | 161 }, |
| 151 | 162 |
| 152 /** @private */ | 163 /** @private */ |
| 153 onNextTap_: function() { | 164 onNextTap_: function() { |
| 154 if (!this.querying) | 165 if (!this.querying) |
| 155 this.groupedOffset = this.groupedOffset - 1; | 166 this.groupedOffset = this.groupedOffset - 1; |
| 156 }, | 167 }, |
| 157 | 168 |
| 158 /** | 169 /** |
| 159 * @private | 170 * @private |
| 160 * @return {boolean} | 171 * @return {boolean} |
| 161 */ | 172 */ |
| 162 isToday_: function() { return this.groupedOffset == 0; }, | 173 isToday_: function() { return this.groupedOffset == 0; }, |
| 163 }); | 174 }); |
| OLD | NEW |