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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 * @param {string} value | 88 * @param {string} value |
89 * @return {string} | 89 * @return {string} |
90 */ | 90 */ |
91 WebInspector.DeviceModeModel.deviceSizeValidator = function(value) | 91 WebInspector.DeviceModeModel.deviceSizeValidator = function(value) |
92 { | 92 { |
93 if (/^[\d]+$/.test(value) && value >= WebInspector.DeviceModeModel.MinDevice
Size && value <= WebInspector.DeviceModeModel.MaxDeviceSize) | 93 if (/^[\d]+$/.test(value) && value >= WebInspector.DeviceModeModel.MinDevice
Size && value <= WebInspector.DeviceModeModel.MaxDeviceSize) |
94 return ""; | 94 return ""; |
95 return WebInspector.UIString("Value must be positive integer"); | 95 return WebInspector.UIString("Value must be positive integer"); |
96 } | 96 } |
97 | 97 |
| 98 /** |
| 99 * @param {string} value |
| 100 * @return {string} |
| 101 */ |
| 102 WebInspector.DeviceModeModel.deviceScaleFactorValidator = function(value) |
| 103 { |
| 104 if (!value || (/^[\d]+(\.\d+)?|\.\d+$/.test(value) && value >= 0 && value <=
10)) |
| 105 return ""; |
| 106 return WebInspector.UIString("Value must be non-negative float"); |
| 107 } |
| 108 |
98 WebInspector.DeviceModeModel._touchEventsScriptIdSymbol = Symbol("DeviceModeMode
l.touchEventsScriptIdSymbol"); | 109 WebInspector.DeviceModeModel._touchEventsScriptIdSymbol = Symbol("DeviceModeMode
l.touchEventsScriptIdSymbol"); |
99 WebInspector.DeviceModeModel._defaultMobileUserAgent = "Mozilla/5.0 (Linux; Andr
oid 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.
0.2490.76 Mobile Safari/537.36"; | 110 WebInspector.DeviceModeModel._defaultMobileUserAgent = "Mozilla/5.0 (Linux; Andr
oid 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.
0.2490.76 Mobile Safari/537.36"; |
100 WebInspector.DeviceModeModel._defaultMobileScaleFactor = 2; | 111 WebInspector.DeviceModeModel._defaultMobileScaleFactor = 2; |
101 | 112 |
102 WebInspector.DeviceModeModel.prototype = { | 113 WebInspector.DeviceModeModel.prototype = { |
103 /** | 114 /** |
104 * @param {!Size} availableSize | 115 * @param {!Size} availableSize |
105 * @param {!Size} preferredSize | 116 * @param {!Size} preferredSize |
106 */ | 117 */ |
107 setAvailableSize: function(availableSize, preferredSize) | 118 setAvailableSize: function(availableSize, preferredSize) |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 if (!this._target || orientation === this._screenOrientation) | 625 if (!this._target || orientation === this._screenOrientation) |
615 return; | 626 return; |
616 | 627 |
617 this._screenOrientation = orientation; | 628 this._screenOrientation = orientation; |
618 if (!this._screenOrientation) | 629 if (!this._screenOrientation) |
619 this._target.screenOrientationAgent().clearScreenOrientationOverride
(); | 630 this._target.screenOrientationAgent().clearScreenOrientationOverride
(); |
620 else | 631 else |
621 this._target.screenOrientationAgent().setScreenOrientationOverride(t
his._screenOrientation === "landscapePrimary" ? 90 : 0, /** @type {!ScreenOrient
ationAgent.OrientationType} */ (this._screenOrientation)); | 632 this._target.screenOrientationAgent().setScreenOrientationOverride(t
his._screenOrientation === "landscapePrimary" ? 90 : 0, /** @type {!ScreenOrient
ationAgent.OrientationType} */ (this._screenOrientation)); |
622 } | 633 } |
623 } | 634 } |
OLD | NEW |