Commit f16e07c6 authored by Dave Tapuska's avatar Dave Tapuska Committed by Chromium LUCI CQ

Remove GuestViewHostMsg_AttachGuest

GuestViewAttachRequest class is never constructed. This means that
GuestViewHostMsg_AttachGuest can be removed as well.

BUG=1143268

Change-Id: I5631a5aacb68a426ec1f5d101aea28cd180b86ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587373Reviewed-by: default avatarLucas Gadani <lfg@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836836}
parent bd435986
......@@ -111,7 +111,6 @@ void GuestViewMessageFilter::OnDestruct() const {
bool GuestViewMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GuestViewMessageFilter, message)
IPC_MESSAGE_HANDLER(GuestViewHostMsg_AttachGuest, OnAttachGuest)
IPC_MESSAGE_HANDLER(GuestViewHostMsg_AttachToEmbedderFrame,
OnAttachToEmbedderFrame)
IPC_MESSAGE_HANDLER(GuestViewHostMsg_ViewCreated, OnViewCreated)
......@@ -139,26 +138,6 @@ void GuestViewMessageFilter::OnViewGarbageCollected(int view_instance_id) {
view_instance_id);
}
void GuestViewMessageFilter::OnAttachGuest(
int element_instance_id,
int guest_instance_id,
const base::DictionaryValue& params) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!browser_context_)
return;
// We should have a GuestViewManager at this point. If we don't then the
// embedder is misbehaving.
auto* manager = GetGuestViewManagerOrKill();
if (!manager)
return;
manager->AttachGuest(render_process_id_,
element_instance_id,
guest_instance_id,
params);
}
void GuestViewMessageFilter::OnAttachToEmbedderFrame(
int embedder_local_render_frame_id,
int element_instance_id,
......
......@@ -68,9 +68,6 @@ class GuestViewMessageFilter : public content::BrowserMessageFilter {
friend class base::DeleteHelper<GuestViewMessageFilter>;
// Message handlers on the UI thread.
void OnAttachGuest(int element_instance_id,
int guest_instance_id,
const base::DictionaryValue& attach_params);
void OnAttachToEmbedderFrame(int embedder_local_render_frame_id,
int element_instance_id,
int guest_instance_id,
......
......@@ -26,13 +26,6 @@ IPC_MESSAGE_CONTROL2(GuestViewMsg_GuestAttached,
// Messages sent from the renderer to the browser.
// Sent by the renderer to set initialization parameters of a Browser Plugin
// that is identified by |element_instance_id|.
IPC_MESSAGE_CONTROL3(GuestViewHostMsg_AttachGuest,
int /* element_instance_id */,
int /* guest_instance_id */,
base::DictionaryValue /* attach_params */)
// We have a RenderFrame with routing id of |embedder_local_frame_routing_id|.
// We want this local frame to be replaced with a remote frame that points
// to a GuestView. This message will attach the local frame to the guest.
......
......@@ -49,56 +49,4 @@ void GuestViewRequest::ExecuteCallbackIfAvailable(
.FromMaybe(v8::Local<v8::Value>());
}
GuestViewAttachRequest::GuestViewAttachRequest(
GuestViewContainer* container,
int guest_instance_id,
std::unique_ptr<base::DictionaryValue> params,
v8::Local<v8::Function> callback,
v8::Isolate* isolate)
: GuestViewRequest(container, callback, isolate),
guest_instance_id_(guest_instance_id),
params_(std::move(params)) {}
GuestViewAttachRequest::~GuestViewAttachRequest() {
}
void GuestViewAttachRequest::PerformRequest() {
if (!container()->render_frame())
return;
// TODO(wjmaclean): Can this next chunk be removed?
// Step 1, send the attach params to guest_view/.
container()->render_frame()->Send(
new GuestViewHostMsg_AttachGuest(container()->element_instance_id(),
guest_instance_id_,
*params_));
}
void GuestViewAttachRequest::HandleResponse(const IPC::Message& message) {
// TODO(fsamuel): Rename this message so that it's apparent that this is a
// response to GuestViewHostMsg_AttachGuest. Perhaps
// GuestViewMsg_AttachGuest_ACK?
GuestViewMsg_GuestAttached::Param param;
if (!GuestViewMsg_GuestAttached::Read(&message, &param))
return;
content::RenderView* guest_proxy_render_view =
content::RenderView::FromRoutingID(std::get<1>(param));
// TODO(fsamuel): Should we be reporting an error to JavaScript or DCHECKing?
if (!guest_proxy_render_view)
return;
v8::HandleScope handle_scope(isolate());
blink::WebFrame* frame = guest_proxy_render_view->GetWebView()->MainFrame();
v8::Local<v8::Value> window = frame->GlobalProxy();
const int argc = 1;
std::unique_ptr<v8::Local<v8::Value>[]> argv(new v8::Local<v8::Value>[argc]);
argv[0] = window;
// Call the AttachGuest API's callback with the guest proxy as the first
// parameter.
ExecuteCallbackIfAvailable(argc, std::move(argv));
}
} // namespace guest_view
......@@ -55,29 +55,6 @@ class GuestViewRequest {
DISALLOW_COPY_AND_ASSIGN(GuestViewRequest);
};
// This class represents an AttachGuest request from Javascript. It includes
// the input parameters and the callback function. The Attach operation may
// not execute immediately, if the container is not ready or if there are
// other GuestViewRequests in flight.
class GuestViewAttachRequest : public GuestViewRequest {
public:
GuestViewAttachRequest(GuestViewContainer* container,
int guest_instance_id,
std::unique_ptr<base::DictionaryValue> params,
v8::Local<v8::Function> callback,
v8::Isolate* isolate);
~GuestViewAttachRequest() override;
void PerformRequest() override;
void HandleResponse(const IPC::Message& message) override;
private:
const int guest_instance_id_;
std::unique_ptr<base::DictionaryValue> params_;
DISALLOW_COPY_AND_ASSIGN(GuestViewAttachRequest);
};
} // namespace guest_view
#endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_
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