Commit 446daa3a authored by fsamuel's avatar fsamuel Committed by Commit bot

<webview>: Remove broken captureVisibleRegion code until feature is properly supported

BUG=430096
TBR=nasko@chromium.org for render_widget_host_view_guest.*
TBR=kenrb@chromium.org for browser_plugin_messages.h
TBR=lazyboy@chromium.org for overall.

Review URL: https://codereview.chromium.org/690263003

Cr-Commit-Position: refs/heads/master@{#302623}
parent 427485ab
......@@ -81,7 +81,6 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view,
guest_visible_(false),
embedder_visible_(true),
is_full_page_plugin_(false),
copy_request_id_(0),
has_render_view_(has_render_view),
is_in_destruction_(false),
last_text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
......@@ -166,8 +165,6 @@ bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CompositorFrameSwappedACK,
OnCompositorFrameSwappedACK)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck,
OnCopyFromCompositingSurfaceAck)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_DragStatusUpdate,
OnDragStatusUpdate)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExecuteEditCommand,
......@@ -293,19 +290,6 @@ void BrowserPluginGuest::UpdateVisibility() {
OnSetVisibility(browser_plugin_instance_id(), visible());
}
void BrowserPluginGuest::CopyFromCompositingSurface(
gfx::Rect src_subrect,
gfx::Size dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback) {
copy_request_callbacks_.insert(std::make_pair(++copy_request_id_, callback));
SendMessageToEmbedder(
new BrowserPluginMsg_CopyFromCompositingSurface(
browser_plugin_instance_id(),
copy_request_id_,
src_subrect,
dst_size));
}
BrowserPluginGuestManager*
BrowserPluginGuest::GetBrowserPluginGuestManager() const {
return GetWebContents()->GetBrowserContext()->GetGuestManager();
......@@ -458,7 +442,6 @@ bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(
const IPC::Message& message) {
switch (message.type()) {
case BrowserPluginHostMsg_CompositorFrameSwappedACK::ID:
case BrowserPluginHostMsg_CopyFromCompositingSurfaceAck::ID:
case BrowserPluginHostMsg_DragStatusUpdate::ID:
case BrowserPluginHostMsg_ExecuteEditCommand::ID:
case BrowserPluginHostMsg_ExtendSelectionAndDelete::ID:
......@@ -742,18 +725,6 @@ void BrowserPluginGuest::OnUnlockMouseAck(int browser_plugin_instance_id) {
mouse_locked_ = false;
}
void BrowserPluginGuest::OnCopyFromCompositingSurfaceAck(
int browser_plugin_instance_id,
int request_id,
const SkBitmap& bitmap) {
CHECK(copy_request_callbacks_.count(request_id));
if (!copy_request_callbacks_.count(request_id))
return;
const CopyRequestCallback& callback = copy_request_callbacks_[request_id];
callback.Run(!bitmap.empty() && !bitmap.isNull(), bitmap);
copy_request_callbacks_.erase(request_id);
}
void BrowserPluginGuest::OnUpdateGeometry(int browser_plugin_instance_id,
const gfx::Rect& view_rect) {
// The plugin has moved within the embedder without resizing or the
......
......@@ -141,11 +141,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver {
void UpdateVisibility();
void CopyFromCompositingSurface(
gfx::Rect src_subrect,
gfx::Size dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback);
BrowserPluginGuestManager* GetBrowserPluginGuestManager() const;
// WebContentsObserver implementation.
......@@ -227,13 +222,10 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver {
bool InAutoSizeBounds(const gfx::Size& size) const;
// Message handlers for messages from embedder.
void OnCompositorFrameSwappedACK(
int instance_id,
const FrameHostMsg_CompositorFrameSwappedACK_Params& params);
void OnCopyFromCompositingSurfaceAck(int instance_id,
int request_id,
const SkBitmap& bitmap);
// Handles drag events from the embedder.
// When dragging, the drag events go to the embedder first, and if the drag
// happens on the browser plugin, then the plugin sends a corresponding
......@@ -348,13 +340,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver {
// Whether the browser plugin is inside a plugin document.
bool is_full_page_plugin_;
// Each copy-request is identified by a unique number. The unique number is
// used to keep track of the right callback.
int copy_request_id_;
typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback;
typedef std::map<int, const CopyRequestCallback> CopyRequestMap;
CopyRequestMap copy_request_callbacks_;
// Indicates that this BrowserPluginGuest has associated renderer-side state.
// This is used to determine whether or not to create a new RenderView when
// this guest is attached. A BrowserPluginGuest would have renderer-side state
......
......@@ -350,15 +350,6 @@ void RenderWidgetHostViewGuest::SelectionBoundsChanged(
rwhv->SelectionBoundsChanged(guest_params);
}
void RenderWidgetHostViewGuest::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
CopyFromCompositingSurfaceCallback& callback,
const SkColorType color_type) {
CHECK(guest_);
guest_->CopyFromCompositingSurface(src_subrect, dst_size, callback);
}
void RenderWidgetHostViewGuest::SetBackgroundColor(SkColor color) {
// Content embedders can toggle opaque backgrounds through this API.
// We plumb the value here so that BrowserPlugin updates its compositing
......
......@@ -91,10 +91,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest
const gfx::Range& range) override;
void SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) override;
void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
CopyFromCompositingSurfaceCallback& callback,
const SkColorType color_type) override;
void OnSwapCompositorFrame(uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) override;
#if defined(USE_AURA)
......
......@@ -116,11 +116,6 @@ IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_HandleInputEvent,
gfx::Rect /* guest_window_rect */,
IPC::WebInputEventPointer /* event */)
IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck,
int /* browser_plugin_instance_id */,
int /* request_id */,
SkBitmap)
// Notify the guest renderer that some resources given to the embededer
// are not used any more.
IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_ReclaimCompositorResources,
......@@ -199,12 +194,6 @@ IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetCursor,
int /* browser_plugin_instance_id */,
content::WebCursor /* cursor */)
IPC_MESSAGE_CONTROL4(BrowserPluginMsg_CopyFromCompositingSurface,
int /* browser_plugin_instance_id */,
int /* request_id */,
gfx::Rect /* source_rect */,
gfx::Size /* dest_size */)
IPC_MESSAGE_CONTROL2(BrowserPluginMsg_CompositorFrameSwapped,
int /* browser_plugin_instance_id */,
FrameMsg_CompositorFrameSwapped_Params /* params */)
......
......@@ -95,8 +95,6 @@ bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus)
IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped,
OnCompositorFrameSwapped(message))
IPC_MESSAGE_HANDLER(BrowserPluginMsg_CopyFromCompositingSurface,
OnCopyFromCompositingSurface)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor)
......@@ -191,23 +189,6 @@ void BrowserPlugin::OnCompositorFrameSwapped(const IPC::Message& message) {
param.b.shared_memory_handle);
}
void BrowserPlugin::OnCopyFromCompositingSurface(int browser_plugin_instance_id,
int request_id,
gfx::Rect source_rect,
gfx::Size dest_size) {
if (!compositing_helper_.get()) {
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck(
render_view_routing_id_,
browser_plugin_instance_id_,
request_id,
SkBitmap()));
return;
}
compositing_helper_->CopyFromCompositingSurface(request_id, source_rect,
dest_size);
}
void BrowserPlugin::OnGuestGone(int browser_plugin_instance_id) {
guest_crashed_ = true;
......@@ -428,7 +409,6 @@ bool BrowserPlugin::ShouldForwardToBrowserPlugin(
case BrowserPluginMsg_Attach_ACK::ID:
case BrowserPluginMsg_AdvanceFocus::ID:
case BrowserPluginMsg_CompositorFrameSwapped::ID:
case BrowserPluginMsg_CopyFromCompositingSurface::ID:
case BrowserPluginMsg_GuestGone::ID:
case BrowserPluginMsg_SetContentsOpaque::ID:
case BrowserPluginMsg_SetCursor::ID:
......
......@@ -172,10 +172,6 @@ class CONTENT_EXPORT BrowserPlugin :
void OnAdvanceFocus(int instance_id, bool reverse);
void OnAttachACK(int browser_plugin_instance_id);
void OnCompositorFrameSwapped(const IPC::Message& message);
void OnCopyFromCompositingSurface(int instance_id,
int request_id,
gfx::Rect source_rect,
gfx::Size dest_size);
void OnGuestGone(int instance_id);
void OnSetContentsOpaque(int instance_id, bool opaque);
void OnSetCursor(int instance_id, const WebCursor& cursor);
......
......@@ -112,21 +112,6 @@ void ChildFrameCompositingHelper::SendReclaimCompositorResourcesToBrowser(
}
}
void ChildFrameCompositingHelper::CopyFromCompositingSurface(
int request_id,
gfx::Rect source_rect,
gfx::Size dest_size) {
CHECK(background_layer_.get());
scoped_ptr<cc::CopyOutputRequest> request =
cc::CopyOutputRequest::CreateBitmapRequest(base::Bind(
&ChildFrameCompositingHelper::CopyFromCompositingSurfaceHasResult,
this,
request_id,
dest_size));
request->set_area(source_rect);
background_layer_->RequestCopyOfOutput(request.Pass());
}
void ChildFrameCompositingHelper::DidCommitCompositorFrame() {
if (!resource_collection_.get() || !ack_pending_)
return;
......@@ -297,27 +282,4 @@ void ChildFrameCompositingHelper::SetContentsOpaque(bool opaque) {
delegated_layer_->SetContentsOpaque(opaque_);
}
void ChildFrameCompositingHelper::CopyFromCompositingSurfaceHasResult(
int request_id,
gfx::Size dest_size,
scoped_ptr<cc::CopyOutputResult> result) {
scoped_ptr<SkBitmap> bitmap;
if (result && result->HasBitmap() && !result->size().IsEmpty())
bitmap = result->TakeBitmap();
SkBitmap resized_bitmap;
if (bitmap) {
resized_bitmap =
skia::ImageOperations::Resize(*bitmap,
skia::ImageOperations::RESIZE_BEST,
dest_size.width(),
dest_size.height());
}
if (GetBrowserPluginManager()) {
GetBrowserPluginManager()->Send(
new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck(
host_routing_id_, GetInstanceID(), request_id, resized_bitmap));
}
}
} // namespace content
......@@ -21,7 +21,6 @@ class SharedMemory;
namespace cc {
class CompositorFrame;
class CopyOutputResult;
class Layer;
class SolidColorLayer;
class DelegatedFrameProvider;
......@@ -59,9 +58,6 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
static ChildFrameCompositingHelper* CreateForRenderFrameProxy(
RenderFrameProxy* render_frame_proxy);
void CopyFromCompositingSurface(int request_id,
gfx::Rect source_rect,
gfx::Size dest_size);
void DidCommitCompositorFrame();
void EnableCompositing(bool);
void OnContainerDestroy();
......@@ -102,10 +98,6 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
float device_scale_factor,
cc::Layer* layer);
void SendReturnedDelegatedResources();
void CopyFromCompositingSurfaceHasResult(
int request_id,
gfx::Size dest_size,
scoped_ptr<cc::CopyOutputResult> result);
int host_routing_id_;
int last_route_id_;
......
......@@ -153,30 +153,6 @@ bool WebViewInternalInsertCSSFunction::ShouldInsertCSS() const {
return true;
}
WebViewInternalCaptureVisibleRegionFunction::
WebViewInternalCaptureVisibleRegionFunction() {
}
WebViewInternalCaptureVisibleRegionFunction::
~WebViewInternalCaptureVisibleRegionFunction() {
}
bool WebViewInternalCaptureVisibleRegionFunction::IsScreenshotEnabled() {
return true;
}
WebContents* WebViewInternalCaptureVisibleRegionFunction::GetWebContentsForID(
int instance_id) {
WebViewGuest* guest = WebViewGuest::From(
render_view_host()->GetProcess()->GetID(), instance_id);
return guest ? guest->web_contents() : NULL;
}
void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure(
FailureReason reason) {
SendResponse(false);
}
WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() {
}
......
......@@ -115,25 +115,6 @@ class WebViewInternalInsertCSSFunction
DISALLOW_COPY_AND_ASSIGN(WebViewInternalInsertCSSFunction);
};
class WebViewInternalCaptureVisibleRegionFunction
: public extensions::CaptureWebContentsFunction {
DECLARE_EXTENSION_FUNCTION("webViewInternal.captureVisibleRegion",
WEBVIEWINTERNAL_CAPTUREVISIBLEREGION);
WebViewInternalCaptureVisibleRegionFunction();
protected:
~WebViewInternalCaptureVisibleRegionFunction() override;
private:
// extensions::CaptureWebContentsFunction implementation.
bool IsScreenshotEnabled() override;
content::WebContents* GetWebContentsForID(int id) override;
void OnCaptureFailure(FailureReason reason) override;
DISALLOW_COPY_AND_ASSIGN(WebViewInternalCaptureVisibleRegionFunction);
};
class WebViewInternalSetNameFunction : public WebViewInternalExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webViewInternal.setName",
......
......@@ -127,28 +127,6 @@
}
]
},
{
"name": "captureVisibleRegion",
"type": "function",
"description": "Captures the visible area of the currently loaded page inside <webview>.",
"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": "setZoom",
"type": "function",
......
......@@ -19,11 +19,6 @@ WebView.prototype.maybeGetExperimentalEvents = function() {
return {};
};
// Captures the visible content within the webview.
WebView.prototype.captureVisibleRegion = function(spec, callback) {
WebViewInternal.captureVisibleRegion(this.guestInstanceId, spec, callback);
};
// Loads a data URL with a specified base URL used for relative links.
// Optionally, a virtual URL can be provided to be shown to the user instead
// of the data URL.
......@@ -46,7 +41,6 @@ WebView.prototype.loadDataWithBaseUrl = function(
// Registers the experimantal WebVIew API when available.
WebView.maybeGetExperimentalAPIs = function() {
var experimentalMethods = [
'captureVisibleRegion',
'loadDataWithBaseUrl'
];
return experimentalMethods;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment