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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 this.settings.emulateMobile = WebInspector.settings.createSetting("emulateMo
bile", false); | 56 this.settings.emulateMobile = WebInspector.settings.createSetting("emulateMo
bile", false); |
57 | 57 |
58 this.settings.emulateTouch = WebInspector.settings.createSetting("emulateTou
ch", false); | 58 this.settings.emulateTouch = WebInspector.settings.createSetting("emulateTou
ch", false); |
59 | 59 |
60 this.settings.overrideGeolocation = WebInspector.settings.createSetting("ove
rrideGeolocation", false); | 60 this.settings.overrideGeolocation = WebInspector.settings.createSetting("ove
rrideGeolocation", false); |
61 this.settings.geolocationOverride = WebInspector.settings.createSetting("geo
locationOverride", ""); | 61 this.settings.geolocationOverride = WebInspector.settings.createSetting("geo
locationOverride", ""); |
62 | 62 |
63 this.settings.overrideDeviceOrientation = WebInspector.settings.createSettin
g("overrideDeviceOrientation", false); | 63 this.settings.overrideDeviceOrientation = WebInspector.settings.createSettin
g("overrideDeviceOrientation", false); |
64 this.settings.deviceOrientationOverride = WebInspector.settings.createSettin
g("deviceOrientationOverride", ""); | 64 this.settings.deviceOrientationOverride = WebInspector.settings.createSettin
g("deviceOrientationOverride", ""); |
65 | 65 |
| 66 this.settings.screenOrientationOverride = WebInspector.settings.createSettin
g("screenOrientationOverride", ""); |
| 67 |
66 this.settings.overrideCSSMedia = WebInspector.settings.createSetting("overri
deCSSMedia", false); | 68 this.settings.overrideCSSMedia = WebInspector.settings.createSetting("overri
deCSSMedia", false); |
67 this.settings.emulatedCSSMedia = WebInspector.settings.createSetting("emulat
edCSSMedia", "print"); | 69 this.settings.emulatedCSSMedia = WebInspector.settings.createSetting("emulat
edCSSMedia", "print"); |
68 | 70 |
69 this.settings.javaScriptDisabled = WebInspector.moduleSetting("javaScriptDis
abled"); | 71 this.settings.javaScriptDisabled = WebInspector.moduleSetting("javaScriptDis
abled"); |
70 } | 72 } |
71 | 73 |
72 WebInspector.OverridesSupport.Events = { | 74 WebInspector.OverridesSupport.Events = { |
73 OverridesWarningUpdated: "OverridesWarningUpdated", | 75 OverridesWarningUpdated: "OverridesWarningUpdated", |
74 EmulationStateChanged: "EmulationStateChanged" | 76 EmulationStateChanged: "EmulationStateChanged" |
75 } | 77 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 reset: function() | 382 reset: function() |
381 { | 383 { |
382 this._deviceMetricsChangedListenerMuted = true; | 384 this._deviceMetricsChangedListenerMuted = true; |
383 this._userAgentChangedListenerMuted = true; | 385 this._userAgentChangedListenerMuted = true; |
384 this.settings.userAgent.set(""); | 386 this.settings.userAgent.set(""); |
385 this.settings.emulateResolution.set(false); | 387 this.settings.emulateResolution.set(false); |
386 this.settings.deviceScaleFactor.set(0); | 388 this.settings.deviceScaleFactor.set(0); |
387 this.settings.emulateTouch.set(false); | 389 this.settings.emulateTouch.set(false); |
388 this.settings.emulateMobile.set(false); | 390 this.settings.emulateMobile.set(false); |
389 this.settings.overrideDeviceOrientation.set(false); | 391 this.settings.overrideDeviceOrientation.set(false); |
| 392 this.settings.screenOrientationOverride.set(""); |
390 this.settings.overrideGeolocation.set(false); | 393 this.settings.overrideGeolocation.set(false); |
391 this.settings.overrideCSSMedia.set(false); | 394 this.settings.overrideCSSMedia.set(false); |
392 delete this._deviceMetricsChangedListenerMuted; | 395 delete this._deviceMetricsChangedListenerMuted; |
393 delete this._userAgentChangedListenerMuted; | 396 delete this._userAgentChangedListenerMuted; |
394 | 397 |
395 if (this._initialized) { | 398 if (this._initialized) { |
396 this._deviceMetricsChanged(); | 399 this._deviceMetricsChanged(); |
397 this._userAgentChanged(); | 400 this._userAgentChanged(); |
398 } | 401 } |
399 }, | 402 }, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 this.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChang
ed, this); | 440 this.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChang
ed, this); |
438 | 441 |
439 this.settings._emulationEnabled.addChangeListener(this._geolocationPosit
ionChanged, this); | 442 this.settings._emulationEnabled.addChangeListener(this._geolocationPosit
ionChanged, this); |
440 this.settings.overrideGeolocation.addChangeListener(this._geolocationPos
itionChanged, this); | 443 this.settings.overrideGeolocation.addChangeListener(this._geolocationPos
itionChanged, this); |
441 this.settings.geolocationOverride.addChangeListener(this._geolocationPos
itionChanged, this); | 444 this.settings.geolocationOverride.addChangeListener(this._geolocationPos
itionChanged, this); |
442 | 445 |
443 this.settings._emulationEnabled.addChangeListener(this._deviceOrientatio
nChanged, this); | 446 this.settings._emulationEnabled.addChangeListener(this._deviceOrientatio
nChanged, this); |
444 this.settings.overrideDeviceOrientation.addChangeListener(this._deviceOr
ientationChanged, this); | 447 this.settings.overrideDeviceOrientation.addChangeListener(this._deviceOr
ientationChanged, this); |
445 this.settings.deviceOrientationOverride.addChangeListener(this._deviceOr
ientationChanged, this); | 448 this.settings.deviceOrientationOverride.addChangeListener(this._deviceOr
ientationChanged, this); |
446 | 449 |
| 450 this.settings._emulationEnabled.addChangeListener(this._screenOrientatio
nChanged, this); |
| 451 this.settings.screenOrientationOverride.addChangeListener(this._screenOr
ientationChanged, this); |
| 452 |
447 this.settings._emulationEnabled.addChangeListener(this._emulateTouchEven
tsChanged, this); | 453 this.settings._emulationEnabled.addChangeListener(this._emulateTouchEven
tsChanged, this); |
448 this.settings.emulateTouch.addChangeListener(this._emulateTouchEventsCha
nged, this); | 454 this.settings.emulateTouch.addChangeListener(this._emulateTouchEventsCha
nged, this); |
449 | 455 |
450 this.settings._emulationEnabled.addChangeListener(this._cssMediaChanged,
this); | 456 this.settings._emulationEnabled.addChangeListener(this._cssMediaChanged,
this); |
451 this.settings.overrideCSSMedia.addChangeListener(this._cssMediaChanged,
this); | 457 this.settings.overrideCSSMedia.addChangeListener(this._cssMediaChanged,
this); |
452 this.settings.emulatedCSSMedia.addChangeListener(this._cssMediaChanged,
this); | 458 this.settings.emulatedCSSMedia.addChangeListener(this._cssMediaChanged,
this); |
453 | 459 |
454 this.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisab
ledChanged, this); | 460 this.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisab
ledChanged, this); |
455 this._javaScriptDisabledChanged(); | 461 this._javaScriptDisabledChanged(); |
456 | 462 |
457 this.settings._emulationEnabled.addChangeListener(this._showRulersChange
d, this); | 463 this.settings._emulationEnabled.addChangeListener(this._showRulersChange
d, this); |
458 WebInspector.moduleSetting("showMetricsRulers").addChangeListener(this._
showRulersChanged, this); | 464 WebInspector.moduleSetting("showMetricsRulers").addChangeListener(this._
showRulersChanged, this); |
459 this._showRulersChanged(); | 465 this._showRulersChanged(); |
460 | 466 |
461 if (this.emulationEnabled()) { | 467 if (this.emulationEnabled()) { |
462 if (this.settings.overrideDeviceOrientation.get()) | 468 if (this.settings.overrideDeviceOrientation.get()) |
463 this._deviceOrientationChanged(); | 469 this._deviceOrientationChanged(); |
464 | 470 |
| 471 if (this.settings.screenOrientationOverride.get()) |
| 472 this._screenOrientationChanged(); |
| 473 |
465 if (this.settings.overrideGeolocation.get()) | 474 if (this.settings.overrideGeolocation.get()) |
466 this._geolocationPositionChanged(); | 475 this._geolocationPositionChanged(); |
467 | 476 |
468 if (this.settings.emulateTouch.get()) | 477 if (this.settings.emulateTouch.get()) |
469 this._emulateTouchEventsChanged(); | 478 this._emulateTouchEventsChanged(); |
470 | 479 |
471 if (this.settings.overrideCSSMedia.get()) | 480 if (this.settings.overrideCSSMedia.get()) |
472 this._cssMediaChanged(); | 481 this._cssMediaChanged(); |
473 | 482 |
474 this._deviceMetricsChanged(); | 483 this._deviceMetricsChanged(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 { | 660 { |
652 if (!this.emulationEnabled() || !this.settings.overrideDeviceOrientation
.get()) { | 661 if (!this.emulationEnabled() || !this.settings.overrideDeviceOrientation
.get()) { |
653 this._target.deviceOrientationAgent().clearDeviceOrientationOverride
(); | 662 this._target.deviceOrientationAgent().clearDeviceOrientationOverride
(); |
654 return; | 663 return; |
655 } | 664 } |
656 | 665 |
657 var deviceOrientation = WebInspector.OverridesSupport.DeviceOrientation.
parseSetting(this.settings.deviceOrientationOverride.get()); | 666 var deviceOrientation = WebInspector.OverridesSupport.DeviceOrientation.
parseSetting(this.settings.deviceOrientationOverride.get()); |
658 this._target.deviceOrientationAgent().setDeviceOrientationOverride(devic
eOrientation.alpha, deviceOrientation.beta, deviceOrientation.gamma); | 667 this._target.deviceOrientationAgent().setDeviceOrientationOverride(devic
eOrientation.alpha, deviceOrientation.beta, deviceOrientation.gamma); |
659 }, | 668 }, |
660 | 669 |
| 670 _screenOrientationChanged: function() |
| 671 { |
| 672 if (!this.emulationEnabled() || !this.settings.screenOrientationOverride
.get()) { |
| 673 this._target.screenOrientationAgent().clearScreenOrientationOverride
(); |
| 674 return; |
| 675 } |
| 676 |
| 677 var screenOrientation = this.settings.screenOrientationOverride.get(); |
| 678 this._target.screenOrientationAgent().setScreenOrientationOverride(scree
nOrientation === "landscapePrimary" ? 90 : 0, screenOrientation); |
| 679 }, |
| 680 |
661 _emulateTouchEventsChanged: function() | 681 _emulateTouchEventsChanged: function() |
662 { | 682 { |
663 var emulationEnabled = this.emulationEnabled() && this.settings.emulateT
ouch.get() && !this._touchEmulationSuspended; | 683 var emulationEnabled = this.emulationEnabled() && this.settings.emulateT
ouch.get() && !this._touchEmulationSuspended; |
664 var configuration = this.settings.emulateMobile.get() ? "mobile" : "desk
top"; | 684 var configuration = this.settings.emulateMobile.get() ? "mobile" : "desk
top"; |
665 var target = this._target; | 685 var target = this._target; |
666 | 686 |
667 /** | 687 /** |
668 * @suppressGlobalPropertiesCheck | 688 * @suppressGlobalPropertiesCheck |
669 */ | 689 */ |
670 const injectedFunction = function() { | 690 const injectedFunction = function() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 }, | 809 }, |
790 | 810 |
791 __proto__: WebInspector.Object.prototype | 811 __proto__: WebInspector.Object.prototype |
792 } | 812 } |
793 | 813 |
794 | 814 |
795 /** | 815 /** |
796 * @type {!WebInspector.OverridesSupport} | 816 * @type {!WebInspector.OverridesSupport} |
797 */ | 817 */ |
798 WebInspector.overridesSupport; | 818 WebInspector.overridesSupport; |
OLD | NEW |