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 * 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 // Trigger a layout after making it visible and before setting | 360 // Trigger a layout after making it visible and before setting |
| 361 // the class to 'selected', so that it animates in. | 361 // the class to 'selected', so that it animates in. |
| 362 /** @suppress {uselessCode} */ | 362 /** @suppress {uselessCode} */ |
| 363 container.offsetTop; | 363 container.offsetTop; |
| 364 container.classList.add('selected'); | 364 container.classList.add('selected'); |
| 365 | 365 |
| 366 setContentChanging(true); | 366 setContentChanging(true); |
| 367 adjustToScroll(0); | 367 adjustToScroll(0); |
| 368 | 368 |
| 369 var selectedFrame = getSelectedIframe().querySelector('iframe'); | 369 var selectedFrame = getSelectedIframe().querySelector('iframe'); |
| 370 uber.invokeMethodOnWindow(selectedFrame.contentWindow, 'frameSelected'); | 370 uber.invokeMethodOnWindow(selectedFrame.contentWindow, 'frameSelected'); |
|
Dan Beam
2014/09/27 00:36:17
if (!selectedFrame.contentDocument.hasFocus())
Evan Stade
2014/09/29 15:24:24
what is the difference between having this check a
Dan Beam
2014/09/29 19:15:47
i believed this might break auto-focused fields (e
| |
| 371 selectedFrame.contentWindow.focus(); | |
| 371 | 372 |
| 372 if (historyOption != HISTORY_STATE_OPTION.NONE) | 373 if (historyOption != HISTORY_STATE_OPTION.NONE) |
| 373 changePathTo({}, path, historyOption); | 374 changePathTo({}, path, historyOption); |
| 374 | 375 |
| 375 if (container.dataset.title) | 376 if (container.dataset.title) |
| 376 document.title = container.dataset.title; | 377 document.title = container.dataset.title; |
| 377 assert('favicon' in container.dataset); | 378 assert('favicon' in container.dataset); |
| 378 | 379 |
| 379 var dataset = /** @type {{favicon: string}} */(container.dataset); | 380 var dataset = /** @type {{favicon: string}} */(container.dataset); |
| 380 $('favicon').href = 'chrome://theme/' + dataset.favicon; | 381 $('favicon').href = 'chrome://theme/' + dataset.favicon; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 } | 453 } |
| 453 | 454 |
| 454 return { | 455 return { |
| 455 onLoad: onLoad, | 456 onLoad: onLoad, |
| 456 onPopHistoryState: onPopHistoryState | 457 onPopHistoryState: onPopHistoryState |
| 457 }; | 458 }; |
| 458 }); | 459 }); |
| 459 | 460 |
| 460 window.addEventListener('popstate', uber.onPopHistoryState); | 461 window.addEventListener('popstate', uber.onPopHistoryState); |
| 461 document.addEventListener('DOMContentLoaded', uber.onLoad); | 462 document.addEventListener('DOMContentLoaded', uber.onLoad); |
| OLD | NEW |