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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {function()} updateCallback | 7 * @param {function()} updateCallback |
8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.DeviceModeModel = function(updateCallback) | 10 WebInspector.DeviceModeModel = function(updateCallback) |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (!screenHeight || screenHeight > this._preferredScaledHeight()) | 423 if (!screenHeight || screenHeight > this._preferredScaledHeight()) |
424 screenHeight = this._preferredScaledHeight(); | 424 screenHeight = this._preferredScaledHeight(); |
425 var mobile = this._uaSetting.get() === WebInspector.DeviceModeModel.
UA.Mobile || this._uaSetting.get() === WebInspector.DeviceModeModel.UA.MobileNoT
ouch; | 425 var mobile = this._uaSetting.get() === WebInspector.DeviceModeModel.
UA.Mobile || this._uaSetting.get() === WebInspector.DeviceModeModel.UA.MobileNoT
ouch; |
426 var defaultDeviceScaleFactor = mobile ? WebInspector.DeviceModeModel
.defaultMobileScaleFactor : 0; | 426 var defaultDeviceScaleFactor = mobile ? WebInspector.DeviceModeModel
.defaultMobileScaleFactor : 0; |
427 this._fitScale = this._calculateFitScale(this._widthSetting.get(), t
his._heightSetting.get()); | 427 this._fitScale = this._calculateFitScale(this._widthSetting.get(), t
his._heightSetting.get()); |
428 this._appliedUserAgentType = this._uaSetting.get(); | 428 this._appliedUserAgentType = this._uaSetting.get(); |
429 this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new In
sets(0, 0, 0, 0), this._scaleSetting.get(), this._deviceScaleFactorSetting.get()
|| defaultDeviceScaleFactor, mobile, screenHeight >= screenWidth ? "portraitPri
mary" : "landscapePrimary", resetPageScaleFactor); | 429 this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new In
sets(0, 0, 0, 0), this._scaleSetting.get(), this._deviceScaleFactorSetting.get()
|| defaultDeviceScaleFactor, mobile, screenHeight >= screenWidth ? "portraitPri
mary" : "landscapePrimary", resetPageScaleFactor); |
430 this._applyUserAgent(mobile ? WebInspector.DeviceModeModel._defaultM
obileUserAgent : ""); | 430 this._applyUserAgent(mobile ? WebInspector.DeviceModeModel._defaultM
obileUserAgent : ""); |
431 this._applyTouch(this._uaSetting.get() === WebInspector.DeviceModeMo
del.UA.DesktopTouch || this._uaSetting.get() === WebInspector.DeviceModeModel.UA
.Mobile, this._uaSetting.get() === WebInspector.DeviceModeModel.UA.Mobile); | 431 this._applyTouch(this._uaSetting.get() === WebInspector.DeviceModeMo
del.UA.DesktopTouch || this._uaSetting.get() === WebInspector.DeviceModeModel.UA
.Mobile, this._uaSetting.get() === WebInspector.DeviceModeModel.UA.Mobile); |
432 } | 432 } |
| 433 if (this._target) |
| 434 this._target.renderingAgent().setShowViewportSizeOnResize(this._type
=== WebInspector.DeviceModeModel.Type.None); |
433 this._updateCallback.call(null); | 435 this._updateCallback.call(null); |
434 }, | 436 }, |
435 | 437 |
436 /** | 438 /** |
437 * @param {number} screenWidth | 439 * @param {number} screenWidth |
438 * @param {number} screenHeight | 440 * @param {number} screenHeight |
439 * @return {number} | 441 * @return {number} |
440 */ | 442 */ |
441 _calculateFitScale: function(screenWidth, screenHeight) | 443 _calculateFitScale: function(screenWidth, screenHeight) |
442 { | 444 { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 545 |
544 /** | 546 /** |
545 * @param {boolean} touchEnabled | 547 * @param {boolean} touchEnabled |
546 * @param {boolean} mobile | 548 * @param {boolean} mobile |
547 */ | 549 */ |
548 _applyTouch: function(touchEnabled, mobile) | 550 _applyTouch: function(touchEnabled, mobile) |
549 { | 551 { |
550 WebInspector.MultitargetTouchModel.instance().setTouchEnabled(touchEnabl
ed, mobile); | 552 WebInspector.MultitargetTouchModel.instance().setTouchEnabled(touchEnabl
ed, mobile); |
551 } | 553 } |
552 } | 554 } |
OLD | NEW |