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