| 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 * Options for how web history should be handled. | 7 * Options for how web history should be handled. |
| 8 */ | 8 */ |
| 9 var HISTORY_STATE_OPTION = { | 9 var HISTORY_STATE_OPTION = { |
| 10 PUSH: 1, // Push a new history state. | 10 PUSH: 1, // Push a new history state. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 */ | 330 */ |
| 331 function showPage(pageId, historyOption, path) { | 331 function showPage(pageId, historyOption, path) { |
| 332 var container = $(pageId); | 332 var container = $(pageId); |
| 333 | 333 |
| 334 // Lazy load of iframe contents. | 334 // Lazy load of iframe contents. |
| 335 var sourceUrl = container.dataset.url + (path || ''); | 335 var sourceUrl = container.dataset.url + (path || ''); |
| 336 var frame = container.querySelector('iframe'); | 336 var frame = container.querySelector('iframe'); |
| 337 if (!frame) { | 337 if (!frame) { |
| 338 frame = container.ownerDocument.createElement('iframe'); | 338 frame = container.ownerDocument.createElement('iframe'); |
| 339 frame.name = pageId; | 339 frame.name = pageId; |
| 340 frame.setAttribute('role', 'presentation'); |
| 340 container.appendChild(frame); | 341 container.appendChild(frame); |
| 341 frame.src = sourceUrl; | 342 frame.src = sourceUrl; |
| 342 } else { | 343 } else { |
| 343 // There's no particularly good way to know what the current URL of the | 344 // There's no particularly good way to know what the current URL of the |
| 344 // content frame is as we don't have access to its contentWindow's | 345 // content frame is as we don't have access to its contentWindow's |
| 345 // location, so just replace every time until necessary to do otherwise. | 346 // location, so just replace every time until necessary to do otherwise. |
| 346 frame.contentWindow.location.replace(sourceUrl); | 347 frame.contentWindow.location.replace(sourceUrl); |
| 347 frame.dataset.ready = false; | 348 frame.dataset.ready = false; |
| 348 } | 349 } |
| 349 | 350 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 467 } |
| 467 | 468 |
| 468 return { | 469 return { |
| 469 onLoad: onLoad, | 470 onLoad: onLoad, |
| 470 onPopHistoryState: onPopHistoryState | 471 onPopHistoryState: onPopHistoryState |
| 471 }; | 472 }; |
| 472 }); | 473 }); |
| 473 | 474 |
| 474 window.addEventListener('popstate', uber.onPopHistoryState); | 475 window.addEventListener('popstate', uber.onPopHistoryState); |
| 475 document.addEventListener('DOMContentLoaded', uber.onLoad); | 476 document.addEventListener('DOMContentLoaded', uber.onLoad); |
| OLD | NEW |