summaryrefslogtreecommitdiffstats
path: root/extensions/common
diff options
context:
space:
mode:
authorwjmaclean <wjmaclean@chromium.org>2016-02-01 14:54:30 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-01 22:55:58 +0000
commitf89035216b627283b79731c3e6a7957707ed9034 (patch)
treebae27a93918c32402c6af6ad5dd7bf66d320766c /extensions/common
parent1624f7e07304daf5b9872643b713de12c6296b2e (diff)
downloadchromium_src-f89035216b627283b79731c3e6a7957707ed9034.zip
chromium_src-f89035216b627283b79731c3e6a7957707ed9034.tar.gz
chromium_src-f89035216b627283b79731c3e6a7957707ed9034.tar.bz2
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. Finally, this CL adds a surface-drawn callback to RenderWidgetHostViewChildFrame, to allow deferring a screen capture request until a frame has actually been drawn. This callback can be used to simplify some existing tests. BUG=326755 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Review URL: https://codereview.chromium.org/1635513003 Cr-Commit-Position: refs/heads/master@{#372799}
Diffstat (limited to 'extensions/common')
-rw-r--r--extensions/common/api/_api_features.json6
-rw-r--r--extensions/common/api/web_view_internal.json27
2 files changed, 33 insertions, 0 deletions
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json
index b30775f..5e07269 100644
--- a/extensions/common/api/_api_features.json
+++ b/extensions/common/api/_api_features.json
@@ -460,6 +460,12 @@
"chrome://oobe/*"
]
}],
+ "webViewExperimentalInternal": [{
+ "internal": true,
+ "channel": "dev",
+ "dependencies": ["permission:webview"],
+ "contexts": ["blessed_extension"]
+ }],
"webViewRequest": [{
"dependencies": ["permission:webview"],
"contexts": ["blessed_extension"]
diff --git a/extensions/common/api/web_view_internal.json b/extensions/common/api/web_view_internal.json
index a33f500..94a6eb9 100644
--- a/extensions/common/api/web_view_internal.json
+++ b/extensions/common/api/web_view_internal.json
@@ -670,6 +670,33 @@
]
},
{
+ "name": "captureVisibleRegion",
+ "type": "function",
+ "description": "foo",
+ "parameters": [
+ {
+ "type": "integer",
+ "name": "instanceId",
+ "description": "The instance ID of the guest <webview> process."
+ },
+ {
+ "$ref": "extensionTypes.ImageDetails",
+ "name": "options",
+ "optional": true
+ },
+ {
+ "type": "function",
+ "name": "callback",
+ "parameters": [
+ {"type": "string",
+ "name": "dataUrl",
+ "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display."
+ }
+ ]
+ }
+ ]
+ },
+ {
"name": "clearData",
"type": "function",
"description": "Clears various types of browsing data stored in a storage partition of a <webview>.",