| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 /** | 5 /** |
| 6 * The different pages that can be shown at a time. | 6 * The different pages that can be shown at a time. |
| 7 * Note: This must remain in sync with the page ids in manager.html! | 7 * Note: This must remain in sync with the page ids in manager.html! |
| 8 * @enum {string} | 8 * @enum {string} |
| 9 */ | 9 */ |
| 10 var Page = { | 10 var Page = { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 case Page.SHORTCUTS: | 89 case Page.SHORTCUTS: |
| 90 path = '/shortcuts'; | 90 path = '/shortcuts'; |
| 91 break; | 91 break; |
| 92 case Page.ERRORS: | 92 case Page.ERRORS: |
| 93 path = '/?errors=' + entry.extensionId; | 93 path = '/?errors=' + entry.extensionId; |
| 94 break; | 94 break; |
| 95 } | 95 } |
| 96 assert(path); | 96 assert(path); |
| 97 var state = {url: path}; | 97 var state = {url: path}; |
| 98 var currentPage = this.getCurrentPage(); | 98 var currentPage = this.getCurrentPage(); |
| 99 var isDialogNavigation = | 99 var isDialogNavigation = currentPage.page == entry.page && |
| 100 currentPage.page == entry.page && | |
| 101 currentPage.extensionId == entry.extensionId; | 100 currentPage.extensionId == entry.extensionId; |
| 102 // Navigating to a dialog doesn't visually change pages; it just opens | 101 // Navigating to a dialog doesn't visually change pages; it just opens |
| 103 // a dialog. As such, we replace state rather than pushing a new state | 102 // a dialog. As such, we replace state rather than pushing a new state |
| 104 // on the stack so that hitting the back button doesn't just toggle the | 103 // on the stack so that hitting the back button doesn't just toggle the |
| 105 // dialog. | 104 // dialog. |
| 106 if (isDialogNavigation) | 105 if (isDialogNavigation) |
| 107 history.replaceState(state, '', path); | 106 history.replaceState(state, '', path); |
| 108 else | 107 else |
| 109 history.pushState(state, '', path); | 108 history.pushState(state, '', path); |
| 110 }, | 109 }, |
| 111 }; | 110 }; |
| 112 | 111 |
| 113 return {NavigationHelper: NavigationHelper}; | 112 return {NavigationHelper: NavigationHelper}; |
| 114 }); | 113 }); |
| OLD | NEW |