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

Unified Diff: ui/webui/resources/js/cr/ui/page_manager/page.js

Issue 555163007: Settings: manage location.hash explicitly on a Page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dbeam comments Created 6 years, 3 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: ui/webui/resources/js/cr/ui/page_manager/page.js
diff --git a/ui/webui/resources/js/cr/ui/page_manager/page.js b/ui/webui/resources/js/cr/ui/page_manager/page.js
index c420a0d2b284da9a1df795bc37e3579b4a0f6f7d..72219354a1ee5aac2a1651337b340101e57279e6 100644
--- a/ui/webui/resources/js/cr/ui/page_manager/page.js
+++ b/ui/webui/resources/js/cr/ui/page_manager/page.js
@@ -28,6 +28,7 @@ cr.define('cr.ui.pageManager', function() {
this.pageDiv.page = null;
this.tab = null;
this.lastFocusedElement = null;
+ this.hash = '';
}
Page.prototype = {
@@ -66,6 +67,12 @@ cr.define('cr.ui.pageManager', function() {
initializePage: function() {},
/**
+ * Called by the PageManager when this.hash changes while the page is
+ * already visible. This is analogous to the hashchange DOM event.
+ */
+ didChangeHash: function() {},
+
+ /**
* Sets focus on the first focusable element. Override for a custom focus
* strategy.
*/
@@ -118,6 +125,19 @@ cr.define('cr.ui.pageManager', function() {
},
/**
+ * Updates the hash of the current page. If the page is topmost, the history
+ * state is updated.
+ * @param {string} hash The new hash value. Like location.hash, this
+ * should include the leading '#' if not empty.
+ */
+ setHash: function(hash) {
+ if (this.hash == hash)
+ return;
+ this.hash = hash;
+ PageManager.onPageHashChanged(this);
+ },
+
+ /**
* Gets the container div for this page if it is an overlay.
* @type {HTMLDivElement}
*/
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | ui/webui/resources/js/cr/ui/page_manager/page_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698