Chromium Code Reviews| 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('uber', function() { | 5 cr.define('uber', function() { |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Options for how web history should be handled. | 8 * Options for how web history should be handled. |
| 9 **/ | 9 **/ |
| 10 var HISTORY_STATE_OPTION = { | 10 var HISTORY_STATE_OPTION = { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 */ | 21 */ |
| 22 var navFrame; | 22 var navFrame; |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * Handles page initialization. | 25 * Handles page initialization. |
| 26 */ | 26 */ |
| 27 function onLoad(e) { | 27 function onLoad(e) { |
| 28 // If the pathname points to a sub-page, we may need to alter the location | 28 // If the pathname points to a sub-page, we may need to alter the location |
| 29 // of one of the frames. | 29 // of one of the frames. |
| 30 var params = resolvePageInfoFromPath(window.location.pathname); | 30 var params = resolvePageInfoFromPath(window.location.pathname); |
| 31 if (params.path) { | 31 if (params.path) { |
|
Evan Stade
2012/01/31 22:58:49
can you move this block to after showPage instead?
csilv
2012/02/01 00:10:49
Done.
| |
| 32 var iframe = $(params.id).querySelector('iframe'); | 32 var iframe = $(params.id).querySelector('iframe'); |
| 33 iframe.src = iframe.dataset.url; | |
| 33 iframe.contentWindow.location.replace(iframe.src + params.path); | 34 iframe.contentWindow.location.replace(iframe.src + params.path); |
| 34 } | 35 } |
| 35 | 36 |
| 36 navFrame = $('navigation'); | 37 navFrame = $('navigation'); |
| 37 | 38 |
| 38 // Select a page based on the page-URL. | 39 // Select a page based on the page-URL. |
| 39 showPage(params.id, HISTORY_STATE_OPTION.REPLACE); | 40 showPage(params.id, HISTORY_STATE_OPTION.REPLACE); |
| 40 | 41 |
| 41 window.addEventListener('message', handleWindowMessage); | 42 window.addEventListener('message', handleWindowMessage); |
| 42 window.setTimeout(function() { | 43 window.setTimeout(function() { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 253 |
| 253 return { | 254 return { |
| 254 onLoad: onLoad, | 255 onLoad: onLoad, |
| 255 onPopHistoryState: onPopHistoryState | 256 onPopHistoryState: onPopHistoryState |
| 256 }; | 257 }; |
| 257 | 258 |
| 258 }); | 259 }); |
| 259 | 260 |
| 260 window.addEventListener('popstate', uber.onPopHistoryState); | 261 window.addEventListener('popstate', uber.onPopHistoryState); |
| 261 document.addEventListener('DOMContentLoaded', uber.onLoad); | 262 document.addEventListener('DOMContentLoaded', uber.onLoad); |
| OLD | NEW |