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

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

Issue 1298503003: DevTools: fix control flow in OverridesSupport.setDeviceMetricsOverride (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@throttler
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 screenHeight = dipHeight + insets.top + insets.bottom; 597 screenHeight = dipHeight + insets.top + insets.bottom;
598 positionX = insets.left; 598 positionX = insets.left;
599 positionY = insets.top; 599 positionY = insets.top;
600 } 600 }
601 this._deviceScale = scale; 601 this._deviceScale = scale;
602 602
603 this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this )); 603 this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this ));
604 604
605 /** 605 /**
606 * @this {WebInspector.OverridesSupport} 606 * @this {WebInspector.OverridesSupport}
607 * @return {!Promise.<undefined>} 607 * @return {!Promise.<?>}
608 */ 608 */
609 function setDeviceMetricsOverride() 609 function setDeviceMetricsOverride()
610 { 610 {
611 var promise = this._target.emulationAgent().setDeviceMetricsOverride ( 611 var setDevicePromise = this._target.emulationAgent().setDeviceMetric sOverride(
612 overrideWidth, overrideHeight, this.settings.emulateResolution.g et() ? this.settings.deviceScaleFactor.get() : 0, 612 overrideWidth, overrideHeight, this.settings.emulateResolution.g et() ? this.settings.deviceScaleFactor.get() : 0,
613 this.settings.emulateMobile.get(), this._pageResizer ? false : t his.settings.deviceFitWindow.get(), scale, 0, 0, 613 this.settings.emulateMobile.get(), this._pageResizer ? false : t his.settings.deviceFitWindow.get(), scale, 0, 0,
614 screenWidth, screenHeight, positionX, positionY, apiCallback.bin d(this)) 614 screenWidth, screenHeight, positionX, positionY, apiCallback.bin d(this))
615 var allPromises = [ setDevicePromise ];
615 if (resetScrollAndPageScale) 616 if (resetScrollAndPageScale)
616 this._target.emulationAgent().resetScrollAndPageScaleFactor(); 617 allPromises.push(this._target.emulationAgent().resetScrollAndPag eScaleFactor());
617 return promise; 618 return Promise.all(allPromises);
618 } 619 }
619 620
620 /** 621 /**
621 * @this {WebInspector.OverridesSupport} 622 * @this {WebInspector.OverridesSupport}
622 * @return {!Promise.<undefined>} 623 * @return {!Promise.<?>}
623 */ 624 */
624 function clearDeviceMetricsOverride() 625 function clearDeviceMetricsOverride()
625 { 626 {
626 return this._target.emulationAgent().clearDeviceMetricsOverride(apiC allback.bind(this)) 627 return this._target.emulationAgent().clearDeviceMetricsOverride(apiC allback.bind(this))
627 } 628 }
628 629
629 /** 630 /**
630 * @param {?Protocol.Error} error 631 * @param {?Protocol.Error} error
631 * @this {WebInspector.OverridesSupport} 632 * @this {WebInspector.OverridesSupport}
632 */ 633 */
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 }, 818 },
818 819
819 __proto__: WebInspector.Object.prototype 820 __proto__: WebInspector.Object.prototype
820 } 821 }
821 822
822 823
823 /** 824 /**
824 * @type {!WebInspector.OverridesSupport} 825 * @type {!WebInspector.OverridesSupport}
825 */ 826 */
826 WebInspector.overridesSupport; 827 WebInspector.overridesSupport;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698