OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 cr.define('cr.ui.pageManager', function() { | 5 cr.define('cr.ui.pageManager', function() { |
6 /** | 6 /** |
7 * PageManager contains a list of root Page and overlay Page objects and | 7 * PageManager contains a list of root Page and overlay Page objects and |
8 * handles "navigation" by showing and hiding these pages and overlays. On | 8 * handles "navigation" by showing and hiding these pages and overlays. On |
9 * initial load, PageManager can use the path to open the correct hierarchy | 9 * initial load, PageManager can use the path to open the correct hierarchy |
10 * of pages and overlay(s). Handlers for user events, like pressing buttons, | 10 * of pages and overlay(s). Handlers for user events, like pressing buttons, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 /** | 76 /** |
77 * Registers new page. | 77 * Registers new page. |
78 * @param {!cr.ui.pageManager.Page} page Page to register. | 78 * @param {!cr.ui.pageManager.Page} page Page to register. |
79 */ | 79 */ |
80 register: function(page) { | 80 register: function(page) { |
81 this.registeredPages[page.name.toLowerCase()] = page; | 81 this.registeredPages[page.name.toLowerCase()] = page; |
82 page.initializePage(); | 82 page.initializePage(); |
83 }, | 83 }, |
84 | 84 |
85 /** | 85 /** |
86 * Unregisters an existing page. | |
87 * @param {!cr.ui.pageManager.Page} page Page to unregister. | |
88 */ | |
89 unregister: function(page) { | |
90 delete this.registeredPages[page.name.toLowerCase()]; | |
dpapad
2017/01/12 22:53:21
Is it necessary to unregister a page? I am wonderi
mbrunson
2017/01/12 23:09:19
Unregistering a page can create an obsolete entry
| |
91 }, | |
92 | |
93 /** | |
86 * Registers a new Overlay page. | 94 * Registers a new Overlay page. |
87 * @param {!cr.ui.pageManager.Page} overlay Overlay to register. | 95 * @param {!cr.ui.pageManager.Page} overlay Overlay to register. |
88 * @param {cr.ui.pageManager.Page} parentPage Associated parent page for | 96 * @param {cr.ui.pageManager.Page} parentPage Associated parent page for |
89 * this overlay. | 97 * this overlay. |
90 * @param {Array} associatedControls Array of control elements associated | 98 * @param {Array} associatedControls Array of control elements associated |
91 * with this page. | 99 * with this page. |
92 */ | 100 */ |
93 registerOverlay: function(overlay, parentPage, associatedControls) { | 101 registerOverlay: function(overlay, parentPage, associatedControls) { |
94 this.registeredOverlayPages[overlay.name.toLowerCase()] = overlay; | 102 this.registeredOverlayPages[overlay.name.toLowerCase()] = overlay; |
95 overlay.parentPage = parentPage; | 103 overlay.parentPage = parentPage; |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 * Called when a page is navigated to. | 758 * Called when a page is navigated to. |
751 * @param {string} path The path of the page being visited. | 759 * @param {string} path The path of the page being visited. |
752 * @param {boolean} replace If true, allow no history events to be created. | 760 * @param {boolean} replace If true, allow no history events to be created. |
753 */ | 761 */ |
754 updateHistory: function(path, replace) {}, | 762 updateHistory: function(path, replace) {}, |
755 }; | 763 }; |
756 | 764 |
757 // Export | 765 // Export |
758 return {PageManager: PageManager}; | 766 return {PageManager: PageManager}; |
759 }); | 767 }); |
OLD | NEW |