blob: f03dcdee6b607e083598b66e23d27de580fa32f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2012 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.
// <include src="../uber/uber_page_manager_observer.js">
// <include src="../uber/uber_utils.js">
(function() {
var HelpPage = help.HelpPage;
var PageManager = cr.ui.pageManager.PageManager;
/**
* DOMContentLoaded handler, sets up the page.
*/
function load() {
PageManager.register(HelpPage.getInstance());
if (help.ChannelChangePage) {
PageManager.registerOverlay(help.ChannelChangePage.getInstance(),
HelpPage.getInstance());
}
PageManager.addObserver(new uber.PageManagerObserver());
PageManager.initialize(HelpPage.getInstance());
uber.onContentFrameLoaded();
var pageName = PageManager.getPageNameFromPath();
// Still update history so that chrome://help/nonexistant redirects
// appropriately to chrome://help/. If the URL matches, updateHistory
// will avoid adding the extra state.
var updateHistory = true;
PageManager.showPageByName(pageName, updateHistory, {replaceState: true});
}
document.addEventListener('DOMContentLoaded', load);
/**
* Listener for the |beforeunload| event.
*/
window.onbeforeunload = function() {
PageManager.willClose();
};
/**
* Listener for the |popstate| event.
* @param {Event} e The |popstate| event.
*/
window.onpopstate = function(e) {
var pageName = PageManager.getPageNameFromPath();
PageManager.setState(pageName, location.hash, e.state);
};
})();
|