Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3695)

Unified Diff: chrome/browser/resources/md_history/history_toolbar.js

Issue 2481693002: [MD History] Make forward/backward work in grouped mode. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/history_toolbar.js
diff --git a/chrome/browser/resources/md_history/history_toolbar.js b/chrome/browser/resources/md_history/history_toolbar.js
index 882bf037278832d0ed47061e7b92f1f095d0333d..fbe0359cf4e4a7509cf13028eea962723dd3b986 100644
--- a/chrome/browser/resources/md_history/history_toolbar.js
+++ b/chrome/browser/resources/md_history/history_toolbar.js
@@ -8,19 +8,11 @@ Polymer({
// Number of history items currently selected.
// TODO(calamity): bind this to
// listContainer.selectedItem.selectedPaths.length.
- count: {
- type: Number,
- value: 0,
- observer: 'changeToolbarView_'
- },
+ count: {type: Number, value: 0, observer: 'changeToolbarView_'},
// True if 1 or more history items are selected. When this value changes
// the background colour changes.
- itemsSelected_: {
- type: Boolean,
- value: false,
- reflectToAttribute: true
- },
+ itemsSelected_: {type: Boolean, value: false, reflectToAttribute: true},
// The most recent term entered in the search field. Updated incrementally
// as the user types.
@@ -32,14 +24,10 @@ Polymer({
// True if the backend is processing and a spinner should be shown in the
// toolbar.
- spinnerActive: {
- type: Boolean,
- value: false
- },
+ spinnerActive: {type: Boolean, value: false},
hasDrawer: {
type: Boolean,
- observer: 'hasDrawerChanged_',
reflectToAttribute: true,
},
@@ -54,11 +42,19 @@ Polymer({
// The period to search over. Matches BrowsingHistoryHandler::Range.
groupedRange: {
type: Number,
- value: 0,
reflectToAttribute: true,
- notify: true
+ notify: true,
+ },
+
+ groupedOffset: {
+ type: Number,
+ notify: true,
},
+ querying: Boolean,
+
+ hasMoreResults: Boolean,
+
// The start time of the query range.
queryStartTime: String,
@@ -76,22 +72,19 @@ Polymer({
.getSearchField();
},
- showSearchField: function() {
- this.searchField.showAndFocus();
- },
+ showSearchField: function() { this.searchField.showAndFocus(); },
/**
* Changes the toolbar background color depending on whether any history items
* are currently selected.
* @private
*/
- changeToolbarView_: function() {
- this.itemsSelected_ = this.count > 0;
- },
+ changeToolbarView_: function() { this.itemsSelected_ = this.count > 0; },
/**
* When changing the search term externally, update the search field to
* reflect the new search term.
+ * @private
*/
searchTermChanged_: function() {
if (this.searchField.getValue() != this.searchTerm) {
@@ -118,13 +111,11 @@ Polymer({
dropdown.open();
},
- onClearSelectionTap_: function() {
- this.fire('unselect-all');
- },
+ /** @private */
+ onClearSelectionTap_: function() { this.fire('unselect-all'); },
- onDeleteTap_: function() {
- this.fire('delete-selected');
- },
+ /** @private */
+ onDeleteTap_: function() { this.fire('delete-selected'); },
/**
* If the user is a supervised user the delete button is not shown.
@@ -134,10 +125,12 @@ Polymer({
return loadTimeData.getBoolean('allowDeletingHistory');
},
+ /** @private */
numberOfItemsSelected_: function(count) {
return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : '';
},
+ /** @private */
getHistoryInterval_: function(queryStartTime, queryEndTime) {
// TODO(calamity): Fix the format of these dates.
return loadTimeData.getStringF(
@@ -145,7 +138,26 @@ Polymer({
},
/** @private */
- hasDrawerChanged_: function() {
- this.updateStyles();
+ onTodayTap_: function() {
+ if (!this.querying)
+ this.groupedOffset = 0;
+ },
+
+ /** @private */
+ onPrevTap_: function() {
+ if (!this.querying)
+ this.groupedOffset = this.groupedOffset + 1;
+ },
+
+ /** @private */
+ onNextTap_: function() {
+ if (!this.querying)
+ this.groupedOffset = this.groupedOffset - 1;
},
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ isToday_: function() { return this.groupedOffset == 0; },
});

Powered by Google App Engine
This is Rietveld 408576698