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

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

Issue 2837463002: DevTools: allow capturing screenshots from command menu. (Closed)
Patch Set: clean Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 */ 629 */
630 async captureScreenshot(fullSize) { 630 async captureScreenshot(fullSize) {
631 var screenCaptureModel = this._target ? this._target.model(SDK.ScreenCapture Model) : null; 631 var screenCaptureModel = this._target ? this._target.model(SDK.ScreenCapture Model) : null;
632 if (!screenCaptureModel) 632 if (!screenCaptureModel)
633 return null; 633 return null;
634 634
635 var metrics = await screenCaptureModel.fetchLayoutMetrics(); 635 var metrics = await screenCaptureModel.fetchLayoutMetrics();
636 if (!metrics) 636 if (!metrics)
637 return null; 637 return null;
638 638
639 if (!this._emulatedPageSize)
640 this._calculateAndEmulate(false);
641 this._target.renderingAgent().setShowViewportSizeOnResize(false);
642
639 var pageSize = fullSize ? new UI.Size(metrics.contentWidth, metrics.contentH eight) : this._emulatedPageSize; 643 var pageSize = fullSize ? new UI.Size(metrics.contentWidth, metrics.contentH eight) : this._emulatedPageSize;
640 var promises = []; 644 var promises = [];
641 promises.push( 645 promises.push(
642 this._target.emulationAgent().setVisibleSize(Math.floor(pageSize.width), Math.floor(pageSize.height))); 646 this._target.emulationAgent().setVisibleSize(Math.floor(pageSize.width), Math.floor(pageSize.height)));
643 if (fullSize) { 647 if (fullSize) {
644 promises.push(this._target.emulationAgent().forceViewport(0, 0, 1)); 648 promises.push(this._target.emulationAgent().forceViewport(0, 0, 1));
645 } else { 649 } else {
646 promises.push(this._target.emulationAgent().forceViewport( 650 promises.push(this._target.emulationAgent().forceViewport(
647 Math.floor(metrics.viewportX), Math.floor(metrics.viewportY), metrics. viewportScale)); 651 Math.floor(metrics.viewportX), Math.floor(metrics.viewportY), metrics. viewportScale));
648 } 652 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 699
696 Emulation.DeviceModeModel.MinDeviceSize = 50; 700 Emulation.DeviceModeModel.MinDeviceSize = 50;
697 Emulation.DeviceModeModel.MaxDeviceSize = 9999; 701 Emulation.DeviceModeModel.MaxDeviceSize = 9999;
698 702
699 703
700 Emulation.DeviceModeModel._defaultMobileUserAgent = 704 Emulation.DeviceModeModel._defaultMobileUserAgent =
701 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/%s Mobile Safari/537.36'; 705 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/%s Mobile Safari/537.36';
702 Emulation.DeviceModeModel._defaultMobileUserAgent = 706 Emulation.DeviceModeModel._defaultMobileUserAgent =
703 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi ceModeModel._defaultMobileUserAgent); 707 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi ceModeModel._defaultMobileUserAgent);
704 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2; 708 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698