Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: Source/devtools/front_end/sdk/OverridesSupport.js

Issue 1040103002: [DevTools] Cleanup Page domain calls, which should be Emulation calls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: supportsRendering to RenderingOptions Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/main/RenderingOptions.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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;
OLDNEW
« no previous file with comments | « Source/devtools/front_end/main/RenderingOptions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698