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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 type: Number, | 44 type: Number, |
45 reflectToAttribute: true, | 45 reflectToAttribute: true, |
46 notify: true, | 46 notify: true, |
47 }, | 47 }, |
48 | 48 |
49 groupedOffset: { | 49 groupedOffset: { |
50 type: Number, | 50 type: Number, |
51 notify: true, | 51 notify: true, |
52 }, | 52 }, |
53 | 53 |
54 hasMoreResults: Boolean, | |
55 | |
54 querying: Boolean, | 56 querying: Boolean, |
55 | 57 |
56 hasMoreResults: Boolean, | 58 queryInfo: Object, |
calamity
2016/12/15 02:17:52
Just FYI, I considered adding a couple more String
| |
57 | |
58 // The start time of the query range. | |
59 queryStartTime: String, | |
60 | |
61 // The end time of the query range. | |
62 queryEndTime: String, | |
63 | 59 |
64 // Whether to show the menu promo (a tooltip that points at the menu button | 60 // Whether to show the menu promo (a tooltip that points at the menu button |
65 // in narrow mode). | 61 // in narrow mode). |
66 showMenuPromo: Boolean, | 62 showMenuPromo: Boolean, |
67 }, | 63 }, |
68 | 64 |
69 /** @return {CrToolbarSearchFieldElement} */ | 65 /** @return {CrToolbarSearchFieldElement} */ |
70 get searchField() { | 66 get searchField() { |
71 return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) | 67 return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) |
72 .getSearchField(); | 68 .getSearchField(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 deletingAllowed_: function() { | 120 deletingAllowed_: function() { |
125 return loadTimeData.getBoolean('allowDeletingHistory'); | 121 return loadTimeData.getBoolean('allowDeletingHistory'); |
126 }, | 122 }, |
127 | 123 |
128 /** @private */ | 124 /** @private */ |
129 numberOfItemsSelected_: function(count) { | 125 numberOfItemsSelected_: function(count) { |
130 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; | 126 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; |
131 }, | 127 }, |
132 | 128 |
133 /** @private */ | 129 /** @private */ |
134 getHistoryInterval_: function(queryStartTime, queryEndTime) { | 130 getHistoryInterval_: function() { |
135 // TODO(calamity): Fix the format of these dates. | 131 var info = this.queryInfo; |
136 return loadTimeData.getStringF( | 132 if (this.groupedRange == HistoryRange.WEEK) { |
137 'historyInterval', queryStartTime, queryEndTime); | 133 return loadTimeData.getStringF( |
134 'historyInterval', info.queryStartTimeShort, info.queryEndTimeShort); | |
135 } | |
136 | |
137 if (this.groupedRange == HistoryRange.MONTH) | |
138 return info.queryStartMonth; | |
138 }, | 139 }, |
139 | 140 |
140 /** @private */ | 141 /** @private */ |
141 onTodayTap_: function() { | 142 onTodayTap_: function() { |
142 if (!this.querying) | 143 if (!this.querying) |
143 this.groupedOffset = 0; | 144 this.groupedOffset = 0; |
144 }, | 145 }, |
145 | 146 |
146 /** @private */ | 147 /** @private */ |
147 onPrevTap_: function() { | 148 onPrevTap_: function() { |
148 if (!this.querying) | 149 if (!this.querying) |
149 this.groupedOffset = this.groupedOffset + 1; | 150 this.groupedOffset = this.groupedOffset + 1; |
150 }, | 151 }, |
151 | 152 |
152 /** @private */ | 153 /** @private */ |
153 onNextTap_: function() { | 154 onNextTap_: function() { |
154 if (!this.querying) | 155 if (!this.querying) |
155 this.groupedOffset = this.groupedOffset - 1; | 156 this.groupedOffset = this.groupedOffset - 1; |
156 }, | 157 }, |
157 | 158 |
158 /** | 159 /** |
159 * @private | 160 * @private |
160 * @return {boolean} | 161 * @return {boolean} |
161 */ | 162 */ |
162 isToday_: function() { return this.groupedOffset == 0; }, | 163 isToday_: function() { return this.groupedOffset == 0; }, |
163 }); | 164 }); |
OLD | NEW |