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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js

Issue 2732923002: Add fromSurface optional parameter to devtools Page.CaptureScreenshot (Closed)
Patch Set: Remove switches include Created 3 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @implements {SDK.TargetManager.Observer} 5 * @implements {SDK.TargetManager.Observer}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Emulation.DeviceModeModel = class { 8 Emulation.DeviceModeModel = class {
9 /** 9 /**
10 * @param {function()} updateCallback 10 * @param {function()} updateCallback
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 promises.push(this._target.emulationAgent().invoke_setDeviceMetricsOverrid e({ 645 promises.push(this._target.emulationAgent().invoke_setDeviceMetricsOverrid e({
646 width: 0, 646 width: 0,
647 height: 0, 647 height: 0,
648 deviceScaleFactor: this._appliedDeviceScaleFactor, 648 deviceScaleFactor: this._appliedDeviceScaleFactor,
649 mobile: this._isMobile(), 649 mobile: this._isMobile(),
650 fitWindow: false, 650 fitWindow: false,
651 scale: this._scale, 651 scale: this._scale,
652 })); 652 }));
653 promises.push(this._target.emulationAgent().setVisibleSize( 653 promises.push(this._target.emulationAgent().setVisibleSize(
654 Math.floor(scaledPageSize.width), Math.floor(scaledPageSize.height))); 654 Math.floor(scaledPageSize.width), Math.floor(scaledPageSize.height)));
655 Promise.all(promises).then(() => screenCaptureModel.captureScreenshot('png ', 100)).then(content => { 655 Promise.all(promises).then(() => screenCaptureModel.captureScreenshot('png ', 100, false)).then(content => {
656 this._target.emulationAgent().setVisibleSize(this._emulatedPageSize.widt h, this._emulatedPageSize.height); 656 this._target.emulationAgent().setVisibleSize(this._emulatedPageSize.widt h, this._emulatedPageSize.height);
657 this._target.emulationAgent().resetViewport(); 657 this._target.emulationAgent().resetViewport();
658 callback(content); 658 callback(content);
659 }); 659 });
660 }); 660 });
661 } 661 }
662 662
663 _deviceMetricsOverrideAppliedForTest() { 663 _deviceMetricsOverrideAppliedForTest() {
664 // Used for sniffing in tests. 664 // Used for sniffing in tests.
665 } 665 }
(...skipping 24 matching lines...) Expand all
690 690
691 Emulation.DeviceModeModel.MinDeviceSize = 50; 691 Emulation.DeviceModeModel.MinDeviceSize = 50;
692 Emulation.DeviceModeModel.MaxDeviceSize = 9999; 692 Emulation.DeviceModeModel.MaxDeviceSize = 9999;
693 693
694 694
695 Emulation.DeviceModeModel._defaultMobileUserAgent = 695 Emulation.DeviceModeModel._defaultMobileUserAgent =
696 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/%s Mobile Safari/537.36'; 696 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/%s Mobile Safari/537.36';
697 Emulation.DeviceModeModel._defaultMobileUserAgent = 697 Emulation.DeviceModeModel._defaultMobileUserAgent =
698 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi ceModeModel._defaultMobileUserAgent); 698 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi ceModeModel._defaultMobileUserAgent);
699 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2; 699 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698