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

Unified Diff: chrome/browser/resources/uber/uber_page_manager_observer.js

Issue 423533003: Use PageManager in About page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix settings app browser test Created 6 years, 4 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/uber/uber_page_manager_observer.js
diff --git a/chrome/browser/resources/uber/uber_page_manager_observer.js b/chrome/browser/resources/uber/uber_page_manager_observer.js
new file mode 100644
index 0000000000000000000000000000000000000000..330fabb30a94303f0706111cca25915c0a57026a
--- /dev/null
+++ b/chrome/browser/resources/uber/uber_page_manager_observer.js
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('uber', function() {
+ var PageManager = cr.ui.pageManager.PageManager;
+
+ /**
+ * A PageManager observer that updates the uber page.
+ * @constructor
+ * @implements {PageManager.Observer}
+ */
+ function PageManagerObserver() {}
+
+ PageManagerObserver.prototype = {
+ __proto__: PageManager.Observer.prototype,
+
+ /**
+ * Informs the uber page when a top-level overlay is opened or closed.
+ * @param {Page} page The page that is being shown or was hidden.
+ * @override
+ */
+ onPageVisibilityChanged: function(page) {
+ if (PageManager.isTopLevelOverlay(page)) {
+ if (page.visible)
+ uber.invokeMethodOnParent('beginInterceptingEvents');
+ else
+ uber.invokeMethodOnParent('stopInterceptingEvents');
+ }
+ },
+
+ /**
+ * Uses uber to set the title.
+ * @param {string} title The title to set.
+ * @override
+ */
+ updateTitle: function(title) {
+ uber.setTitle(title);
+ },
+
+ /**
+ * Pushes the current page onto the history stack, replacing the current
+ * entry if appropriate.
+ * @param {string} path The path of the page to push onto the stack.
+ * @param {boolean} replace If true, allow no history events to be created.
+ * @override
+ */
+ updateHistory: function(path, replace) {
+ var historyFunction = replace ? uber.replaceState : uber.pushState;
+ historyFunction({}, path);
+ },
+ };
+
+ // Export
+ return {
+ PageManagerObserver: PageManagerObserver
+ };
+});
« no previous file with comments | « chrome/browser/resources/options/options_settings_app.js ('k') | chrome/browser/resources/uber/uber_shared.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698