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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager; | 6 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager; |
7 | 7 |
8 ///////////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////////// |
9 // OptionsPage class: | 9 // OptionsPage class: |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (OptionsPage.isDialog) | 229 if (OptionsPage.isDialog) |
230 return; | 230 return; |
231 | 231 |
232 var page = this.getTopmostVisiblePage(); | 232 var page = this.getTopmostVisiblePage(); |
233 var path = window.location.pathname + window.location.hash; | 233 var path = window.location.pathname + window.location.hash; |
234 if (path) | 234 if (path) |
235 path = path.slice(1).replace(/\/(?:#|$)/, ''); // Remove trailing slash. | 235 path = path.slice(1).replace(/\/(?:#|$)/, ''); // Remove trailing slash. |
236 | 236 |
237 // The page is already in history (the user may have clicked the same link | 237 // The page is already in history (the user may have clicked the same link |
238 // twice). Do nothing. | 238 // twice). Do nothing. |
239 if (path == page.name && !OptionsPage.isLoading()) | 239 var hash = opt_params && opt_params.ignoreHash ? '' : window.location.hash; |
| 240 var newPath = (page == this.getDefaultPage() ? '' : page.name) + hash; |
| 241 if (path == newPath && !OptionsPage.isLoading()) |
240 return; | 242 return; |
241 | 243 |
242 var hash = opt_params && opt_params.ignoreHash ? '' : window.location.hash; | |
243 | |
244 var newPath = (page == this.getDefaultPage() ? '' : page.name) + hash; | |
245 var historyFunction = replace ? uber.replaceState : uber.pushState; | 244 var historyFunction = replace ? uber.replaceState : uber.pushState; |
246 historyFunction.call(uber, {pageName: page.name}, newPath); | 245 historyFunction.call(uber, {pageName: page.name}, newPath); |
247 }; | 246 }; |
248 | 247 |
249 /** | 248 /** |
250 * Shows a registered Overlay page. Does not update history. | 249 * Shows a registered Overlay page. Does not update history. |
251 * @param {string} overlayName Page name. | 250 * @param {string} overlayName Page name. |
252 * @param {OptionPage} rootPage The currently visible root-level page. | 251 * @param {OptionPage} rootPage The currently visible root-level page. |
253 * @return {boolean} whether we showed an overlay. | 252 * @return {boolean} whether we showed an overlay. |
254 */ | 253 */ |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 canShowPage: function() { | 1008 canShowPage: function() { |
1010 return true; | 1009 return true; |
1011 }, | 1010 }, |
1012 }; | 1011 }; |
1013 | 1012 |
1014 // Export | 1013 // Export |
1015 return { | 1014 return { |
1016 OptionsPage: OptionsPage | 1015 OptionsPage: OptionsPage |
1017 }; | 1016 }; |
1018 }); | 1017 }); |
OLD | NEW |