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

Issue 1582053002: Implement webview.captureVisibleRegion() (Closed)

Created:
4 years, 11 months ago by wjmaclean
Modified:
4 years, 11 months ago
CC:
asvitkine+watch_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, creis+watch_chromium.org, danakj+watch_chromium.org, darin-cc_chromium.org, extensions-reviews_chromium.org, jam, jbauman+watch_chromium.org, kalyank, miu+watch_chromium.org, nasko+codewatch_chromium.org, piman+watch_chromium.org, sievers+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement webview.captureVisibleRegion() This CL implements webview.captureVisibleRegion(), an extension/apps API to allow WebView users to capture screenshots of the contents displayed in a WebView. The surfaces contents capture has been plumbed via RenderWidgetHostViewChildFrame so this implementation should not require changes when WebView switches to using OOPIF. As part of the implementation, there are two notable refactors: 1) CaptureWebContentsFunction has been refactored into WebContentsCaptureClient to remove the extensions::AsyncExtensionFunction dependence so that this code can be used by both tabs.captureVisibleTab and webview.captureVisibleRegion, and 2) common code from DelegatedFrameHost has ben moved to content/browser/compositor/surface_utils.* in order to avoid duplication as both DelegatedFrameHost and RenderWidgetHostViewChildFrame now use the code. BUG=326755 Committed: https://crrev.com/5b8cdcc82fc9da7bab15fd3dbf65df843dc73589 Cr-Commit-Position: refs/heads/master@{#370565}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Fix histograms.xml #

Total comments: 6

Patch Set 3 : Address comments, fix Android linker error. #

Patch Set 4 : RenderWidgetHostViewChildFrame::CopyFromCompositingSurface() does nothing on Android. #

Patch Set 5 : Move captureVisibleRegion() to experimental API. #

Total comments: 22

Patch Set 6 : Address comments; move util functions to surface_utils in content/browser/compositor. #

Patch Set 7 : Fix Android compile. #

Total comments: 14

Patch Set 8 : Fix minor errors (no change in functionality). #

Total comments: 2

Patch Set 9 : Don't enable experimental WebView APIs for WebUI. #

Patch Set 10 : Fix test so it waits for the first frame to be generated. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+558 lines, -466 lines) Patch
M chrome/browser/extensions/api/tabs/tabs_api.h View 1 2 2 chunks +12 lines, -4 lines 0 comments Download
M chrome/browser/extensions/api/tabs/tabs_api.cc View 1 2 3 4 5 6 7 2 chunks +38 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/webview_tag.json View 1 chunk +22 lines, -0 lines 0 comments Download
M content/browser/compositor/delegated_frame_host.h View 1 2 3 4 5 1 chunk +0 lines, -15 lines 0 comments Download
M content/browser/compositor/delegated_frame_host.cc View 1 2 3 4 5 6 7 8 9 3 chunks +5 lines, -153 lines 0 comments Download
M content/browser/compositor/surface_utils.h View 1 2 3 4 5 6 7 2 chunks +10 lines, -0 lines 0 comments Download
M content/browser/compositor/surface_utils.cc View 1 2 3 4 5 6 7 8 9 3 chunks +170 lines, -0 lines 0 comments Download
M content/browser/frame_host/render_widget_host_view_child_frame.cc View 1 2 3 4 5 2 chunks +16 lines, -4 lines 0 comments Download
M content/public/test/browser_test_utils.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
M content/public/test/browser_test_utils.cc View 1 2 3 4 5 6 7 8 9 1 chunk +13 lines, -0 lines 0 comments Download
D extensions/browser/api/capture_web_contents_function.h View 1 chunk +0 lines, -67 lines 0 comments Download
D extensions/browser/api/capture_web_contents_function.cc View 1 chunk +0 lines, -150 lines 0 comments Download
M extensions/browser/api/guest_view/extension_view/extension_view_internal_api.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M extensions/browser/api/guest_view/web_view/web_view_internal_api.h View 1 2 2 chunks +24 lines, -1 line 0 comments Download
M extensions/browser/api/guest_view/web_view/web_view_internal_api.cc View 1 2 3 4 5 6 7 1 chunk +56 lines, -0 lines 0 comments Download
A + extensions/browser/api/web_contents_capture_client.h View 1 2 3 4 5 6 7 2 chunks +14 lines, -23 lines 0 comments Download
A + extensions/browser/api/web_contents_capture_client.cc View 1 2 3 4 5 6 7 8 9 6 chunks +39 lines, -45 lines 1 comment Download
M extensions/browser/guest_view/web_view/web_view_apitest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +29 lines, -0 lines 1 comment Download
M extensions/common/api/_api_features.json View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M extensions/common/api/web_view_internal.json View 1 chunk +27 lines, -0 lines 0 comments Download
M extensions/extensions.gypi View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 2 3 4 5 6 7 8 9 2 chunks +6 lines, -0 lines 0 comments Download
M extensions/renderer/resources/extensions_renderer_resources.grd View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M extensions/renderer/resources/guest_view/web_view/web_view.js View 1 2 3 4 2 chunks +8 lines, -0 lines 0 comments Download
A extensions/renderer/resources/guest_view/web_view/web_view_experimental.js View 1 2 3 4 1 chunk +24 lines, -0 lines 0 comments Download
M extensions/test/data/web_view/apitest/main.js View 1 2 3 4 5 6 7 8 9 2 chunks +33 lines, -1 line 0 comments Download

Messages

Total messages: 44 (19 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1582053002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1582053002/20001
4 years, 11 months ago (2016-01-13 18:13:47 UTC) #7
wjmaclean
kenrb@ - could you take a look at the content/ changes? rockot@ - please look ...
4 years, 11 months ago (2016-01-13 18:14:46 UTC) #8
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_chromium_gn_compile_rel/builds/7578) linux_android_rel_ng on ...
4 years, 11 months ago (2016-01-13 18:31:41 UTC) #11
Ken Rockot(use gerrit already)
looks good overall https://codereview.chromium.org/1582053002/diff/20001/extensions/browser/api/capture_web_contents.h File extensions/browser/api/capture_web_contents.h (right): https://codereview.chromium.org/1582053002/diff/20001/extensions/browser/api/capture_web_contents.h#newcode23 extensions/browser/api/capture_web_contents.h:23: class CaptureWebContents { It's unusual to ...
4 years, 11 months ago (2016-01-13 22:41:35 UTC) #12
wjmaclean
rockot@ - PTAL? https://codereview.chromium.org/1582053002/diff/20001/extensions/browser/api/capture_web_contents.h File extensions/browser/api/capture_web_contents.h (right): https://codereview.chromium.org/1582053002/diff/20001/extensions/browser/api/capture_web_contents.h#newcode23 extensions/browser/api/capture_web_contents.h:23: class CaptureWebContents { On 2016/01/13 22:41:35, ...
4 years, 11 months ago (2016-01-18 16:20:12 UTC) #13
kenrb
lgtm
4 years, 11 months ago (2016-01-18 16:36:43 UTC) #14
Charlie Reis
[+nick for ideas on how to lay out this code] I'm not thrilled with either ...
4 years, 11 months ago (2016-01-19 22:45:36 UTC) #16
ncarter (slow)
https://codereview.chromium.org/1582053002/diff/80001/content/browser/readback_request_helpers.h File content/browser/readback_request_helpers.h (right): https://codereview.chromium.org/1582053002/diff/80001/content/browser/readback_request_helpers.h#newcode6 content/browser/readback_request_helpers.h:6: #define CONTENT_BROWSER_READBACK_REQUEST_HELPERS_H_ On 2016/01/19 22:45:36, Charlie Reis wrote: > ...
4 years, 11 months ago (2016-01-20 00:16:19 UTC) #17
kenrb
https://codereview.chromium.org/1582053002/diff/80001/content/browser/readback_request_helpers.h File content/browser/readback_request_helpers.h (right): https://codereview.chromium.org/1582053002/diff/80001/content/browser/readback_request_helpers.h#newcode21 content/browser/readback_request_helpers.h:21: namespace content { On 2016/01/19 22:45:36, Charlie Reis wrote: ...
4 years, 11 months ago (2016-01-20 01:43:04 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1582053002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1582053002/100001
4 years, 11 months ago (2016-01-20 15:27:39 UTC) #20
wjmaclean
Hi all, PTAL? I'll admit, I wasn't entirely sure of where to put the ReadbackRequestUtils ...
4 years, 11 months ago (2016-01-20 15:32:37 UTC) #21
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: cast_shell_android on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/cast_shell_android/builds/10392)
4 years, 11 months ago (2016-01-20 15:43:21 UTC) #23
ncarter (slow)
https://codereview.chromium.org/1582053002/diff/120001/content/browser/compositor/delegated_frame_host.cc File content/browser/compositor/delegated_frame_host.cc (right): https://codereview.chromium.org/1582053002/diff/120001/content/browser/compositor/delegated_frame_host.cc#newcode903 content/browser/compositor/delegated_frame_host.cc:903: else { https://engdoc.corp.google.com/eng/doc/devguide/cpp/styleguide.shtml?cl=head#Conditionals """However, if one part of an ...
4 years, 11 months ago (2016-01-20 21:20:49 UTC) #24
wjmaclean
Minor errors fixed, ptal? https://codereview.chromium.org/1582053002/diff/120001/content/browser/compositor/delegated_frame_host.cc File content/browser/compositor/delegated_frame_host.cc (right): https://codereview.chromium.org/1582053002/diff/120001/content/browser/compositor/delegated_frame_host.cc#newcode903 content/browser/compositor/delegated_frame_host.cc:903: else { On 2016/01/20 21:20:49, ...
4 years, 11 months ago (2016-01-20 21:45:19 UTC) #25
Ken Rockot(use gerrit already)
lgtm sorry for the delay, forgot to send earlier
4 years, 11 months ago (2016-01-20 21:46:24 UTC) #27
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1582053002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1582053002/140001
4 years, 11 months ago (2016-01-20 21:46:28 UTC) #28
Fady Samuel
https://codereview.chromium.org/1582053002/diff/140001/extensions/common/api/_api_features.json File extensions/common/api/_api_features.json (right): https://codereview.chromium.org/1582053002/diff/140001/extensions/common/api/_api_features.json#newcode469 extensions/common/api/_api_features.json:469: "internal": true, Drive by: I think we turn on ...
4 years, 11 months ago (2016-01-20 21:50:22 UTC) #30
wjmaclean
I've disable experimental WebView APIs on WebUI. https://codereview.chromium.org/1582053002/diff/140001/extensions/common/api/_api_features.json File extensions/common/api/_api_features.json (right): https://codereview.chromium.org/1582053002/diff/140001/extensions/common/api/_api_features.json#newcode469 extensions/common/api/_api_features.json:469: "internal": true, ...
4 years, 11 months ago (2016-01-20 21:58:13 UTC) #31
ncarter (slow)
lgtm
4 years, 11 months ago (2016-01-20 22:03:17 UTC) #34
Charlie Reis
Much better, thanks! content/ LGTM too.
4 years, 11 months ago (2016-01-20 22:09:36 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1582053002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1582053002/160001
4 years, 11 months ago (2016-01-20 23:42:24 UTC) #38
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 11 months ago (2016-01-21 02:15:51 UTC) #40
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/5b8cdcc82fc9da7bab15fd3dbf65df843dc73589 Cr-Commit-Position: refs/heads/master@{#370565}
4 years, 11 months ago (2016-01-21 02:17:46 UTC) #42
tsergeant
A revert of this CL (patchset #9 id:160001) has been created in https://codereview.chromium.org/1614703003/ by tsergeant@chromium.org. ...
4 years, 11 months ago (2016-01-21 06:49:05 UTC) #43
Fady Samuel
4 years, 11 months ago (2016-01-25 16:20:39 UTC) #44
Message was sent while issue was closed.
This seems like it could be a problem in practice as well, rather than a testing
bug. I think the API implementation should internally request a new frame if one
isn't available yet and wait until the new frame becomes available.

https://codereview.chromium.org/1582053002/diff/180001/extensions/browser/api...
File extensions/browser/api/web_contents_capture_client.cc (right):

https://codereview.chromium.org/1582053002/diff/180001/extensions/browser/api...
extensions/browser/api/web_contents_capture_client.cc:85: // TODO(wjmaclean):
Improve error reporting. Why aren't we passing more
Remove this now?

https://codereview.chromium.org/1582053002/diff/180001/extensions/browser/gue...
File extensions/browser/guest_view/web_view/web_view_apitest.cc (right):

https://codereview.chromium.org/1582053002/diff/180001/extensions/browser/gue...
extensions/browser/guest_view/web_view/web_view_apitest.cc:758:
WaitForFirstFrame(guest_web_contents);
This seems like a broken API if we have to do this.

Powered by Google App Engine
This is Rietveld 408576698