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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ScreenCaptureModel.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 /** 5 /**
6 * @implements {Protocol.PageDispatcher} 6 * @implements {Protocol.PageDispatcher}
7 */ 7 */
8 SDK.ScreenCaptureModel = class extends SDK.SDKModel { 8 SDK.ScreenCaptureModel = class extends SDK.SDKModel {
9 /** 9 /**
10 * @param {!SDK.Target} target 10 * @param {!SDK.Target} target
(...skipping 25 matching lines...) Expand all
36 36
37 stopScreencast() { 37 stopScreencast() {
38 this._onScreencastFrame = null; 38 this._onScreencastFrame = null;
39 this._onScreencastVisibilityChanged = null; 39 this._onScreencastVisibilityChanged = null;
40 this._agent.stopScreencast(); 40 this._agent.stopScreencast();
41 } 41 }
42 42
43 /** 43 /**
44 * @param {string} format 44 * @param {string} format
45 * @param {number} quality 45 * @param {number} quality
46 * @param {boolean|undefined} fromSurface
dgozman 2017/03/08 19:21:37 Let's remove this parameter, and always pass false
dvallet 2017/03/09 06:19:47 Done.
46 * @return {!Promise<?string>} 47 * @return {!Promise<?string>}
47 */ 48 */
48 captureScreenshot(format, quality) { 49 captureScreenshot(format, quality, fromSurface) {
49 var fulfill; 50 var fulfill;
50 var promise = new Promise(callback => fulfill = callback); 51 var promise = new Promise(callback => fulfill = callback);
51 this._agent.captureScreenshot(format, quality, (error, content) => { 52 this._agent.captureScreenshot(format, quality, fromSurface, (error, content) => {
52 if (error) 53 if (error)
53 console.error(error); 54 console.error(error);
54 fulfill(error ? null : content); 55 fulfill(error ? null : content);
55 }); 56 });
56 return promise; 57 return promise;
57 } 58 }
58 59
59 /** 60 /**
60 * @return {!Promise<?{width: number, height: number}>} 61 * @return {!Promise<?{width: number, height: number}>}
61 */ 62 */
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 196 }
196 197
197 /** 198 /**
198 * @override 199 * @override
199 */ 200 */
200 navigationRequested() { 201 navigationRequested() {
201 } 202 }
202 }; 203 };
203 204
204 SDK.SDKModel.register(SDK.ScreenCaptureModel, SDK.Target.Capability.ScreenCaptur e); 205 SDK.SDKModel.register(SDK.ScreenCaptureModel, SDK.Target.Capability.ScreenCaptur e);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698