| 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 23 matching lines...) Expand all Loading... |
| 34 spinnerActive: { | 34 spinnerActive: { |
| 35 type: Boolean, | 35 type: Boolean, |
| 36 value: false, | 36 value: false, |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 hasDrawer: { | 39 hasDrawer: { |
| 40 type: Boolean, | 40 type: Boolean, |
| 41 reflectToAttribute: true, | 41 reflectToAttribute: true, |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 // The period to search over. Matches BrowsingHistoryHandler::Range. | |
| 45 groupedRange: { | |
| 46 type: Number, | |
| 47 reflectToAttribute: true, | |
| 48 }, | |
| 49 | |
| 50 showGroupedControls: { | |
| 51 type: Boolean, | |
| 52 reflectToAttribute: true, | |
| 53 }, | |
| 54 | |
| 55 // Show an (i) button on the right of the toolbar to display a notice about | 44 // Show an (i) button on the right of the toolbar to display a notice about |
| 56 // synced history. | 45 // synced history. |
| 57 showSyncNotice: { | 46 showSyncNotice: { |
| 58 type: Boolean, | 47 type: Boolean, |
| 59 observer: 'showSyncNoticeChanged_', | 48 observer: 'showSyncNoticeChanged_', |
| 60 }, | 49 }, |
| 61 | 50 |
| 62 // Sync notice is currently visible. | 51 // Sync notice is currently visible. |
| 63 syncNoticeVisible_: { | 52 syncNoticeVisible_: { |
| 64 type: Boolean, | 53 type: Boolean, |
| 65 value: false, | 54 value: false, |
| 66 }, | 55 }, |
| 67 | 56 |
| 68 hasMoreResults: Boolean, | 57 hasMoreResults: Boolean, |
| 69 | 58 |
| 70 groupedOffset: Number, | |
| 71 | |
| 72 // Whether domain-grouped history is enabled. | |
| 73 isGroupedMode: Boolean, | |
| 74 | |
| 75 querying: Boolean, | 59 querying: Boolean, |
| 76 | 60 |
| 77 queryInfo: Object, | 61 queryInfo: Object, |
| 78 | 62 |
| 79 // Whether to show the menu promo (a tooltip that points at the menu button | 63 // Whether to show the menu promo (a tooltip that points at the menu button |
| 80 // in narrow mode). | 64 // in narrow mode). |
| 81 showMenuPromo: Boolean, | 65 showMenuPromo: Boolean, |
| 82 }, | 66 }, |
| 83 | 67 |
| 84 /** | 68 /** |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 * @private | 183 * @private |
| 200 */ | 184 */ |
| 201 deletingAllowed_: function() { | 185 deletingAllowed_: function() { |
| 202 return loadTimeData.getBoolean('allowDeletingHistory'); | 186 return loadTimeData.getBoolean('allowDeletingHistory'); |
| 203 }, | 187 }, |
| 204 | 188 |
| 205 /** @private */ | 189 /** @private */ |
| 206 numberOfItemsSelected_: function(count) { | 190 numberOfItemsSelected_: function(count) { |
| 207 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; | 191 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; |
| 208 }, | 192 }, |
| 209 | |
| 210 /** @private */ | |
| 211 getHistoryInterval_: function() { | |
| 212 var info = this.queryInfo; | |
| 213 if (!info) | |
| 214 return; | |
| 215 | |
| 216 if (this.groupedRange == HistoryRange.WEEK) | |
| 217 return info.queryInterval; | |
| 218 | |
| 219 if (this.groupedRange == HistoryRange.MONTH) | |
| 220 return info.queryStartMonth; | |
| 221 }, | |
| 222 | |
| 223 /** | |
| 224 * @param {Event} e | |
| 225 * @private | |
| 226 */ | |
| 227 onTabSelected_: function(e) { | |
| 228 this.fire( | |
| 229 'change-query', {range: Number(e.detail.item.getAttribute('value'))}); | |
| 230 }, | |
| 231 | |
| 232 /** | |
| 233 * @param {number} newOffset | |
| 234 * @private | |
| 235 */ | |
| 236 changeOffset_: function(newOffset) { | |
| 237 if (!this.querying) | |
| 238 this.fire('change-query', {offset: newOffset}); | |
| 239 }, | |
| 240 | |
| 241 /** @private */ | |
| 242 onTodayTap_: function() { | |
| 243 this.changeOffset_(0); | |
| 244 }, | |
| 245 | |
| 246 /** @private */ | |
| 247 onPrevTap_: function() { | |
| 248 this.changeOffset_(this.groupedOffset + 1); | |
| 249 }, | |
| 250 | |
| 251 /** @private */ | |
| 252 onNextTap_: function() { | |
| 253 this.changeOffset_(this.groupedOffset - 1); | |
| 254 }, | |
| 255 | |
| 256 /** | |
| 257 * @private | |
| 258 * @return {boolean} | |
| 259 */ | |
| 260 isToday_: function() { | |
| 261 return this.groupedOffset == 0; | |
| 262 }, | |
| 263 }); | 193 }); |
| OLD | NEW |