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

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

Issue 2042973002: [MD History] Add routing to the synced devices page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hide_search_bar
Patch Set: address comments Created 4 years, 5 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/app.js
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js
index 6d3f5d4e2d111d016111463a05fa1550b1bec366..a4f6370dd897f844bcf1fe1d3f866c0075467ba4 100644
--- a/chrome/browser/resources/md_history/app.js
+++ b/chrome/browser/resources/md_history/app.js
@@ -44,8 +44,18 @@ Polymer({
};
}
},
+
+ // Route data for the current page.
+ routeData_: Object,
},
+ observers: [
+ // routeData_.page <=> selectedPage
+ 'routeDataChanged_(routeData_.page)',
+ 'selectedPageChanged_(selectedPage_)',
+ ],
+
+ // TODO(calamity): Replace these event listeners with data bound properties.
listeners: {
'cr-menu-tap': 'onMenuTap_',
'history-checkbox-select': 'checkboxSelected',
@@ -159,7 +169,7 @@ Polymer({
* @private
*/
syncedTabsSelected_: function(selectedPage) {
- return selectedPage == 'synced-devices';
+ return selectedPage == 'syncedTabs';
},
/**
@@ -173,4 +183,34 @@ Polymer({
shouldShowSpinner_: function(querying, incremental, searchTerm) {
return querying && !incremental && searchTerm != '';
},
+
+ /**
+ * @param {string} page
+ * @private
+ */
+ routeDataChanged_: function(page) {
+ this.selectedPage_ = page;
+ },
+
+ /**
+ * @param {string} selectedPage
+ * @private
+ */
+ selectedPageChanged_: function(selectedPage) {
+ this.set('routeData_.page', selectedPage);
+ },
+
+ /**
+ * This computed binding is needed to make the iron-pages selector update when
+ * the synced-device-manager is instantiated for the first time. Otherwise the
+ * fallback selection will continue to be used after the corresponding item is
+ * added as a child of iron-pages.
+ * @param {string} selectedPage
+ * @param {Array} items
+ * @return {string}
+ * @private
+ */
+ getSelectedPage_(selectedPage, items) {
+ return selectedPage;
+ },
});

Powered by Google App Engine
This is Rietveld 408576698