OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 <include src="../uber/uber_page_manager_observer.js"> | 5 <include src="../uber/uber_page_manager_observer.js"> |
6 <include src="../uber/uber_utils.js"> | 6 <include src="../uber/uber_utils.js"> |
7 | 7 |
8 var ChannelChangePage = help.ChannelChangePage; | 8 var ChannelChangePage = help.ChannelChangePage; |
9 var HelpPage = help.HelpPage; | 9 var HelpPage = help.HelpPage; |
10 var PageManager = cr.ui.pageManager.PageManager; | 10 var PageManager = cr.ui.pageManager.PageManager; |
11 | 11 |
12 /** | 12 /** |
13 * DOMContentLoaded handler, sets up the page. | 13 * DOMContentLoaded handler, sets up the page. |
14 */ | 14 */ |
15 function load() { | 15 function load() { |
16 PageManager.register(HelpPage.getInstance()); | 16 PageManager.register(HelpPage.getInstance()); |
17 | 17 |
18 if (cr.isChromeOS) { | 18 if (cr.isChromeOS) { |
19 PageManager.registerOverlay(ChannelChangePage.getInstance(), | 19 PageManager.registerOverlay(ChannelChangePage.getInstance(), |
20 HelpPage.getInstance()); | 20 HelpPage.getInstance()); |
21 } | 21 } |
22 cr.ui.FocusManager.disableMouseFocusOnButtons(); | 22 cr.ui.FocusManager.disableMouseFocusOnButtons(); |
23 PageManager.addObserver(new uber.PageManagerObserver()); | 23 PageManager.addObserver(new uber.PageManagerObserver()); |
24 PageManager.initialize(HelpPage.getInstance()); | 24 PageManager.initialize(HelpPage.getInstance()); |
25 uber.onContentFrameLoaded(); | |
michaelpg
2014/08/08 14:03:47
I wouldn't mind updating help_browsertest.js to te
| |
25 | 26 |
26 var pageName = PageManager.getPageNameFromPath(); | 27 var pageName = PageManager.getPageNameFromPath(); |
27 // Still update history so that chrome://help/nonexistant redirects | 28 // Still update history so that chrome://help/nonexistant redirects |
28 // appropriately to chrome://help/. If the URL matches, updateHistory | 29 // appropriately to chrome://help/. If the URL matches, updateHistory |
29 // will avoid adding the extra state. | 30 // will avoid adding the extra state. |
30 var updateHistory = true; | 31 var updateHistory = true; |
31 PageManager.showPageByName(pageName, updateHistory, {replaceState: true}); | 32 PageManager.showPageByName(pageName, updateHistory, {replaceState: true}); |
32 | |
33 uber.onContentFrameLoaded(); | |
34 } | 33 } |
35 | 34 |
36 document.addEventListener('DOMContentLoaded', load); | 35 document.addEventListener('DOMContentLoaded', load); |
37 | 36 |
38 /** | 37 /** |
39 * Listener for the |beforeunload| event. | 38 * Listener for the |beforeunload| event. |
40 */ | 39 */ |
41 window.onbeforeunload = function() { | 40 window.onbeforeunload = function() { |
42 PageManager.willClose(); | 41 PageManager.willClose(); |
43 }; | 42 }; |
44 | 43 |
45 /** | 44 /** |
46 * Listener for the |popstate| event. | 45 * Listener for the |popstate| event. |
47 * @param {Event} e The |popstate| event. | 46 * @param {Event} e The |popstate| event. |
48 */ | 47 */ |
49 window.onpopstate = function(e) { | 48 window.onpopstate = function(e) { |
50 var pageName = PageManager.getPageNameFromPath(); | 49 var pageName = PageManager.getPageNameFromPath(); |
51 PageManager.setState(pageName, e.state); | 50 PageManager.setState(pageName, e.state); |
52 }; | 51 }; |
OLD | NEW |