| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 var alpha = isAlphaValid ? parseFloat(alphaString) : -1; | 241 var alpha = isAlphaValid ? parseFloat(alphaString) : -1; |
| 242 var beta = isBetaValid ? parseFloat(betaString) : -1; | 242 var beta = isBetaValid ? parseFloat(betaString) : -1; |
| 243 var gamma = isGammaValid ? parseFloat(gammaString) : -1; | 243 var gamma = isGammaValid ? parseFloat(gammaString) : -1; |
| 244 | 244 |
| 245 return new WebInspector.OverridesSupport.DeviceOrientation(alpha, beta, gamm
a); | 245 return new WebInspector.OverridesSupport.DeviceOrientation(alpha, beta, gamm
a); |
| 246 } | 246 } |
| 247 | 247 |
| 248 WebInspector.OverridesSupport.DeviceOrientation._clearDeviceOrientationOverride
= function() | 248 WebInspector.OverridesSupport.DeviceOrientation._clearDeviceOrientationOverride
= function() |
| 249 { | 249 { |
| 250 for (var target of WebInspector.targetManager.targets()) | 250 for (var target of WebInspector.targetManager.targets()) |
| 251 target.pageAgent().clearDeviceOrientationOverride(); | 251 target.deviceOrientationAgent().clearDeviceOrientationOverride(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 /** | 254 /** |
| 255 * @param {string} value | 255 * @param {string} value |
| 256 * @return {string} | 256 * @return {string} |
| 257 */ | 257 */ |
| 258 WebInspector.OverridesSupport.deviceSizeValidator = function(value) | 258 WebInspector.OverridesSupport.deviceSizeValidator = function(value) |
| 259 { | 259 { |
| 260 if (!value || (/^[\d]+$/.test(value) && value >= 0 && value <= WebInspector.
OverridesSupport.MaxDeviceSize)) | 260 if (!value || (/^[\d]+$/.test(value) && value >= 0 && value <= WebInspector.
OverridesSupport.MaxDeviceSize)) |
| 261 return ""; | 261 return ""; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 }, | 619 }, |
| 620 | 620 |
| 621 _deviceMetricsOverrideAppliedForTest: function() | 621 _deviceMetricsOverrideAppliedForTest: function() |
| 622 { | 622 { |
| 623 // Used for sniffing in tests. | 623 // Used for sniffing in tests. |
| 624 }, | 624 }, |
| 625 | 625 |
| 626 _geolocationPositionChanged: function() | 626 _geolocationPositionChanged: function() |
| 627 { | 627 { |
| 628 if (!this.emulationEnabled() || !this.settings.overrideGeolocation.get()
) { | 628 if (!this.emulationEnabled() || !this.settings.overrideGeolocation.get()
) { |
| 629 for (var target of WebInspector.targetManager.targets()) | 629 for (var target of WebInspector.targetManager.targets()) { |
| 630 target.emulationAgent().clearGeolocationOverride(); | 630 if (target.supportsEmulation()) |
| 631 target.emulationAgent().clearGeolocationOverride(); |
| 632 } |
| 631 return; | 633 return; |
| 632 } | 634 } |
| 633 var geolocation = WebInspector.OverridesSupport.GeolocationPosition.pars
eSetting(this.settings.geolocationOverride.get()); | 635 var geolocation = WebInspector.OverridesSupport.GeolocationPosition.pars
eSetting(this.settings.geolocationOverride.get()); |
| 634 for (var target of WebInspector.targetManager.targets()) { | 636 for (var target of WebInspector.targetManager.targets()) { |
| 637 if (!target.supportsEmulation()) |
| 638 continue; |
| 635 if (geolocation.error) | 639 if (geolocation.error) |
| 636 target.emulationAgent().setGeolocationOverride(); | 640 target.emulationAgent().setGeolocationOverride(); |
| 637 else | 641 else |
| 638 target.emulationAgent().setGeolocationOverride(geolocation.latit
ude, geolocation.longitude, 150); | 642 target.emulationAgent().setGeolocationOverride(geolocation.latit
ude, geolocation.longitude, 150); |
| 639 } | 643 } |
| 640 }, | 644 }, |
| 641 | 645 |
| 642 _deviceOrientationChanged: function() | 646 _deviceOrientationChanged: function() |
| 643 { | 647 { |
| 644 if (!this.emulationEnabled() || !this.settings.overrideDeviceOrientation
.get()) { | 648 if (!this.emulationEnabled() || !this.settings.overrideDeviceOrientation
.get()) { |
| 645 WebInspector.OverridesSupport.DeviceOrientation._clearDeviceOrientat
ionOverride(); | 649 WebInspector.OverridesSupport.DeviceOrientation._clearDeviceOrientat
ionOverride(); |
| 646 return; | 650 return; |
| 647 } | 651 } |
| 648 | 652 |
| 649 var deviceOrientation = WebInspector.OverridesSupport.DeviceOrientation.
parseSetting(this.settings.deviceOrientationOverride.get()); | 653 var deviceOrientation = WebInspector.OverridesSupport.DeviceOrientation.
parseSetting(this.settings.deviceOrientationOverride.get()); |
| 650 for (var target of WebInspector.targetManager.targets()) | 654 for (var target of WebInspector.targetManager.targets()) |
| 651 target.pageAgent().setDeviceOrientationOverride(deviceOrientation.al
pha, deviceOrientation.beta, deviceOrientation.gamma); | 655 target.deviceOrientationAgent().setDeviceOrientationOverride(deviceO
rientation.alpha, deviceOrientation.beta, deviceOrientation.gamma); |
| 652 }, | 656 }, |
| 653 | 657 |
| 654 _emulateTouchEventsChanged: function() | 658 _emulateTouchEventsChanged: function() |
| 655 { | 659 { |
| 656 var emulateTouch = this.emulationEnabled() && this.settings.emulateTouch
.get() && !this._touchEmulationSuspended; | 660 var emulateTouch = this.emulationEnabled() && this.settings.emulateTouch
.get() && !this._touchEmulationSuspended; |
| 657 for (var target of WebInspector.targetManager.targets()) { | 661 for (var target of WebInspector.targetManager.targets()) { |
| 658 if (target.supportsEmulation()) | 662 if (target.supportsEmulation()) |
| 659 target.domModel.emulateTouchEventObjects(emulateTouch, this.sett
ings.emulateMobile.get() ? "mobile" : "desktop"); | 663 target.domModel.emulateTouchEventObjects(emulateTouch, this.sett
ings.emulateMobile.get() ? "mobile" : "desktop"); |
| 660 } | 664 } |
| 661 }, | 665 }, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 }, | 809 }, |
| 806 | 810 |
| 807 __proto__: WebInspector.Object.prototype | 811 __proto__: WebInspector.Object.prototype |
| 808 } | 812 } |
| 809 | 813 |
| 810 | 814 |
| 811 /** | 815 /** |
| 812 * @type {!WebInspector.OverridesSupport} | 816 * @type {!WebInspector.OverridesSupport} |
| 813 */ | 817 */ |
| 814 WebInspector.overridesSupport; | 818 WebInspector.overridesSupport; |
| OLD | NEW |