OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @implements {SDK.TargetManager.Observer} | 5 * @implements {SDK.TargetManager.Observer} |
6 * @unrestricted | 6 * @unrestricted |
7 */ | 7 */ |
8 Emulation.DeviceModeModel = class { | 8 Emulation.DeviceModeModel = class { |
9 /** | 9 /** |
10 * @param {function()} updateCallback | 10 * @param {function()} updateCallback |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 this._scaleSetting.get(), this._deviceScaleFactorSetting.get() || defa
ultDeviceScaleFactor, mobile, | 465 this._scaleSetting.get(), this._deviceScaleFactorSetting.get() || defa
ultDeviceScaleFactor, mobile, |
466 screenHeight >= screenWidth ? Protocol.Emulation.ScreenOrientationType
.PortraitPrimary : | 466 screenHeight >= screenWidth ? Protocol.Emulation.ScreenOrientationType
.PortraitPrimary : |
467 Protocol.Emulation.ScreenOrientationType
.LandscapePrimary, | 467 Protocol.Emulation.ScreenOrientationType
.LandscapePrimary, |
468 resetPageScaleFactor); | 468 resetPageScaleFactor); |
469 this._applyUserAgent(mobile ? Emulation.DeviceModeModel._defaultMobileUser
Agent : ''); | 469 this._applyUserAgent(mobile ? Emulation.DeviceModeModel._defaultMobileUser
Agent : ''); |
470 this._applyTouch( | 470 this._applyTouch( |
471 this._uaSetting.get() === Emulation.DeviceModeModel.UA.DesktopTouch || | 471 this._uaSetting.get() === Emulation.DeviceModeModel.UA.DesktopTouch || |
472 this._uaSetting.get() === Emulation.DeviceModeModel.UA.Mobile, | 472 this._uaSetting.get() === Emulation.DeviceModeModel.UA.Mobile, |
473 this._uaSetting.get() === Emulation.DeviceModeModel.UA.Mobile); | 473 this._uaSetting.get() === Emulation.DeviceModeModel.UA.Mobile); |
474 } | 474 } |
475 if (this._target) | 475 var overlayModel = this._target ? this._target.model(SDK.OverlayModel) : nul
l; |
476 this._target.renderingAgent().setShowViewportSizeOnResize(this._type === E
mulation.DeviceModeModel.Type.None); | 476 if (overlayModel) |
| 477 overlayModel.setShowViewportSizeOnResize(this._type === Emulation.DeviceMo
deModel.Type.None); |
477 this._updateCallback.call(null); | 478 this._updateCallback.call(null); |
478 } | 479 } |
479 | 480 |
480 /** | 481 /** |
481 * @param {number} screenWidth | 482 * @param {number} screenWidth |
482 * @param {number} screenHeight | 483 * @param {number} screenHeight |
483 * @param {!UI.Insets=} outline | 484 * @param {!UI.Insets=} outline |
484 * @param {!UI.Insets=} insets | 485 * @param {!UI.Insets=} insets |
485 * @return {number} | 486 * @return {number} |
486 */ | 487 */ |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 696 |
696 Emulation.DeviceModeModel.MinDeviceSize = 50; | 697 Emulation.DeviceModeModel.MinDeviceSize = 50; |
697 Emulation.DeviceModeModel.MaxDeviceSize = 9999; | 698 Emulation.DeviceModeModel.MaxDeviceSize = 9999; |
698 | 699 |
699 | 700 |
700 Emulation.DeviceModeModel._defaultMobileUserAgent = | 701 Emulation.DeviceModeModel._defaultMobileUserAgent = |
701 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (
KHTML, like Gecko) Chrome/%s Mobile Safari/537.36'; | 702 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (
KHTML, like Gecko) Chrome/%s Mobile Safari/537.36'; |
702 Emulation.DeviceModeModel._defaultMobileUserAgent = | 703 Emulation.DeviceModeModel._defaultMobileUserAgent = |
703 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi
ceModeModel._defaultMobileUserAgent); | 704 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi
ceModeModel._defaultMobileUserAgent); |
704 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2; | 705 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2; |
OLD | NEW |