Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / resources / uber / uber_page_manager_observer.js
blobeffea4e48b258bae27368116c7d188f4bb9b550a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 cr.define('uber', function() {
6 var PageManager = cr.ui.pageManager.PageManager;
8 /**
9 * A PageManager observer that updates the uber page.
10 * @constructor
11 * @implements {cr.ui.pageManager.PageManager.Observer}
13 function PageManagerObserver() {}
15 PageManagerObserver.prototype = {
16 __proto__: PageManager.Observer.prototype,
18 /**
19 * Informs the uber page when a top-level overlay is opened or closed.
20 * @param {cr.ui.pageManager.Page} page The page that is being shown or was
21 * hidden.
22 * @override
24 onPageVisibilityChanged: function(page) {
25 if (PageManager.isTopLevelOverlay(page)) {
26 if (page.visible)
27 uber.invokeMethodOnParent('beginInterceptingEvents');
28 else
29 uber.invokeMethodOnParent('stopInterceptingEvents');
33 /**
34 * Uses uber to set the title.
35 * @param {string} title The title to set.
36 * @override
38 updateTitle: function(title) {
39 uber.setTitle(title);
42 /**
43 * Pushes the current page onto the history stack, replacing the current
44 * entry if appropriate.
45 * @param {string} path The path of the page to push onto the stack.
46 * @param {boolean} replace If true, allow no history events to be created.
47 * @override
49 updateHistory: function(path, replace) {
50 var historyFunction = replace ? uber.replaceState : uber.pushState;
51 historyFunction({}, path);
55 // Export
56 return {
57 PageManagerObserver: PageManagerObserver
59 });