| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.Object} | 33 * @extends {WebInspector.Object} |
| 34 * @param {boolean} responsiveDesignAvailable | |
| 35 */ | 34 */ |
| 36 WebInspector.OverridesSupport = function(responsiveDesignAvailable) | 35 WebInspector.OverridesSupport = function() |
| 37 { | 36 { |
| 38 this._touchEmulationSuspended = false; | 37 this._touchEmulationSuspended = false; |
| 39 this._emulateMobileEnabled = false; | 38 this._emulateMobileEnabled = false; |
| 40 this._userAgent = ""; | 39 this._userAgent = ""; |
| 41 this._pageResizer = null; | 40 this._pageResizer = null; |
| 42 this._deviceScale = 1; | 41 this._deviceScale = 1; |
| 43 this._fixedDeviceScale = false; | 42 this._fixedDeviceScale = false; |
| 44 this._initialized = false; | 43 this._initialized = false; |
| 45 this._deviceMetricsThrottler = new WebInspector.Throttler(0); | 44 this._deviceMetricsThrottler = new WebInspector.Throttler(0); |
| 46 this._responsiveDesignAvailable = responsiveDesignAvailable; | |
| 47 | 45 |
| 48 this.settings = {}; | 46 this.settings = {}; |
| 49 this.settings._emulationEnabled = WebInspector.settings.createSetting("emula
tionEnabled", false); | 47 this.settings._emulationEnabled = WebInspector.settings.createSetting("emula
tionEnabled", false); |
| 50 | 48 |
| 51 this.settings.userAgent = WebInspector.settings.createSetting("userAgent", "
"); | 49 this.settings.userAgent = WebInspector.settings.createSetting("userAgent", "
"); |
| 52 | 50 |
| 53 this.settings.emulateResolution = WebInspector.settings.createSetting("emula
teResolution", true); | 51 this.settings.emulateResolution = WebInspector.settings.createSetting("emula
teResolution", true); |
| 54 this.settings.deviceWidth = WebInspector.settings.createSetting("deviceWidth
", 360); | 52 this.settings.deviceWidth = WebInspector.settings.createSetting("deviceWidth
", 360); |
| 55 this.settings.deviceHeight = WebInspector.settings.createSetting("deviceHeig
ht", 640); | 53 this.settings.deviceHeight = WebInspector.settings.createSetting("deviceHeig
ht", 640); |
| 56 this.settings.deviceScaleFactor = WebInspector.settings.createSetting("devic
eScaleFactor", 0); | 54 this.settings.deviceScaleFactor = WebInspector.settings.createSetting("devic
eScaleFactor", 0); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 { | 289 { |
| 292 if (this.canEmulate()) { | 290 if (this.canEmulate()) { |
| 293 this.settings._emulationEnabled.set(enabled); | 291 this.settings._emulationEnabled.set(enabled); |
| 294 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.E
mulationStateChanged); | 292 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.E
mulationStateChanged); |
| 295 if (enabled && this.settings.emulateResolution.get()) | 293 if (enabled && this.settings.emulateResolution.get()) |
| 296 this._target.emulationAgent().resetScrollAndPageScaleFactor(); | 294 this._target.emulationAgent().resetScrollAndPageScaleFactor(); |
| 297 } | 295 } |
| 298 }, | 296 }, |
| 299 | 297 |
| 300 /** | 298 /** |
| 301 * @return {boolean} | |
| 302 */ | |
| 303 responsiveDesignAvailable: function() | |
| 304 { | |
| 305 return this._responsiveDesignAvailable; | |
| 306 }, | |
| 307 | |
| 308 /** | |
| 309 * @param {!WebInspector.Target} target | 299 * @param {!WebInspector.Target} target |
| 310 * @param {function()} callback | 300 * @param {function()} callback |
| 311 */ | 301 */ |
| 312 init: function(target, callback) | 302 init: function(target, callback) |
| 313 { | 303 { |
| 314 if (target.isPage()) | 304 if (target.isPage()) |
| 315 target.emulationAgent().canEmulate(canEmulateCallback.bind(this)); | 305 target.emulationAgent().canEmulate(canEmulateCallback.bind(this)); |
| 316 else | 306 else |
| 317 canEmulateCallback.call(this, null, false); | 307 canEmulateCallback.call(this, null, false); |
| 318 | 308 |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 }, | 810 }, |
| 821 | 811 |
| 822 __proto__: WebInspector.Object.prototype | 812 __proto__: WebInspector.Object.prototype |
| 823 } | 813 } |
| 824 | 814 |
| 825 | 815 |
| 826 /** | 816 /** |
| 827 * @type {!WebInspector.OverridesSupport} | 817 * @type {!WebInspector.OverridesSupport} |
| 828 */ | 818 */ |
| 829 WebInspector.overridesSupport; | 819 WebInspector.overridesSupport; |
| OLD | NEW |