1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/guest_view/renderer/iframe_guest_view_request.h"
7 #include "components/guest_view/common/guest_view_messages.h"
8 #include "components/guest_view/renderer/guest_view_container.h"
9 #include "content/public/renderer/render_frame.h"
11 namespace guest_view
{
13 GuestViewAttachIframeRequest::GuestViewAttachIframeRequest(
14 guest_view::GuestViewContainer
* container
,
15 int render_frame_routing_id
,
16 int guest_instance_id
,
17 scoped_ptr
<base::DictionaryValue
> params
,
18 v8::Local
<v8::Function
> callback
,
20 : GuestViewRequest(container
, callback
, isolate
),
21 render_frame_routing_id_(render_frame_routing_id
),
22 guest_instance_id_(guest_instance_id
),
23 params_(params
.Pass()) {
26 GuestViewAttachIframeRequest::~GuestViewAttachIframeRequest() {
29 void GuestViewAttachIframeRequest::PerformRequest() {
30 DCHECK(container()->render_frame());
32 container()->render_frame()->Send(new GuestViewHostMsg_AttachToEmbedderFrame(
33 render_frame_routing_id_
, container()->element_instance_id(),
34 guest_instance_id_
, *params_
));
37 void GuestViewAttachIframeRequest::HandleResponse(const IPC::Message
& message
) {
38 GuestViewMsg_AttachToEmbedderFrame_ACK::Param param
;
39 bool message_read_status
=
40 GuestViewMsg_AttachToEmbedderFrame_ACK::Read(&message
, ¶m
);
41 DCHECK(message_read_status
);
43 ExecuteCallbackIfAvailable(0, nullptr);
46 } // namespace guest_view