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

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

Issue 2643533003: MD History: Use one-way binding for history query state. (Closed)
Patch Set: Rebase Created 3 years, 11 months 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 37007482d7c3ab8f5d2e79d8aa937074ced1e16d..53c8438f21b8fed1927753a87f613930f2921bde 100644
--- a/chrome/browser/resources/md_history/history_toolbar.js
+++ b/chrome/browser/resources/md_history/history_toolbar.js
@@ -27,7 +27,6 @@ Polymer({
searchTerm: {
type: String,
observer: 'searchTermChanged_',
- notify: true,
},
// True if the backend is processing and a spinner should be shown in the
@@ -52,13 +51,9 @@ Polymer({
groupedRange: {
type: Number,
reflectToAttribute: true,
- notify: true,
},
- groupedOffset: {
- type: Number,
- notify: true,
- },
+ groupedOffset: Number,
hasMoreResults: Boolean,
@@ -109,7 +104,7 @@ Polymer({
* @private
*/
onSearchChanged_: function(event) {
- this.searchTerm = /** @type {string} */ (event.detail);
+ this.fire('change-query', {search: event.detail});
},
/** @private */
@@ -155,22 +150,37 @@ Polymer({
return info.queryStartMonth;
},
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onTabSelected_: function(e) {
+ this.fire(
+ 'change-query', {range: Number(e.detail.item.getAttribute('value'))});
calamity 2017/01/23 03:03:56 FYI the setter for the grouped range already makes
tsergeant 2017/01/23 04:18:26 Gonna leave it here to be extra sure -- I was noti
+ },
+
+ /**
+ * @param {number} newOffset
+ * @private
+ */
+ changeOffset_: function(newOffset) {
+ if (!this.querying)
+ this.fire('change-query', {offset: newOffset});
+ },
+
/** @private */
onTodayTap_: function() {
- if (!this.querying)
- this.groupedOffset = 0;
+ this.changeOffset_(0);
},
/** @private */
onPrevTap_: function() {
- if (!this.querying)
- this.groupedOffset = this.groupedOffset + 1;
+ this.changeOffset_(this.groupedOffset + 1);
},
/** @private */
onNextTap_: function() {
- if (!this.querying)
- this.groupedOffset = this.groupedOffset - 1;
+ this.changeOffset_(this.groupedOffset - 1);
},
/**

Powered by Google App Engine
This is Rietveld 408576698