| 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/guest_view_request.h" | 5 #include "components/guest_view/renderer/guest_view_request.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "components/guest_view/common/guest_view_messages.h" | 10 #include "components/guest_view/common/guest_view_messages.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 v8::Local<v8::Function> callback, | 55 v8::Local<v8::Function> callback, |
| 56 v8::Isolate* isolate) | 56 v8::Isolate* isolate) |
| 57 : GuestViewRequest(container, callback, isolate), | 57 : GuestViewRequest(container, callback, isolate), |
| 58 guest_instance_id_(guest_instance_id), | 58 guest_instance_id_(guest_instance_id), |
| 59 params_(std::move(params)) {} | 59 params_(std::move(params)) {} |
| 60 | 60 |
| 61 GuestViewAttachRequest::~GuestViewAttachRequest() { | 61 GuestViewAttachRequest::~GuestViewAttachRequest() { |
| 62 } | 62 } |
| 63 | 63 |
| 64 void GuestViewAttachRequest::PerformRequest() { | 64 void GuestViewAttachRequest::PerformRequest() { |
| 65 if (!container()->render_frame()) | 65 content::RenderFrame* render_frame = container()->render_frame(); |
| 66 if (!render_frame) |
| 66 return; | 67 return; |
| 67 | 68 |
| 68 // Step 1, send the attach params to guest_view/. | 69 // Step 1, send the attach params to guest_view/. |
| 69 container()->render_frame()->Send( | 70 render_frame->Send(new GuestViewHostMsg_AttachGuest( |
| 70 new GuestViewHostMsg_AttachGuest(container()->element_instance_id(), | 71 container()->element_instance_id(), guest_instance_id_, |
| 71 guest_instance_id_, | 72 render_frame->GetRoutingID(), *params_)); |
| 72 *params_)); | |
| 73 | 73 |
| 74 // Step 2, attach plugin through content/. | 74 // Step 2, attach plugin through content/. |
| 75 container()->render_frame()->AttachGuest(container()->element_instance_id()); | 75 render_frame->AttachGuest(container()->element_instance_id()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void GuestViewAttachRequest::HandleResponse(const IPC::Message& message) { | 78 void GuestViewAttachRequest::HandleResponse(const IPC::Message& message) { |
| 79 // TODO(fsamuel): Rename this message so that it's apparent that this is a | 79 // TODO(fsamuel): Rename this message so that it's apparent that this is a |
| 80 // response to GuestViewHostMsg_AttachGuest. Perhaps | 80 // response to GuestViewHostMsg_AttachGuest. Perhaps |
| 81 // GuestViewMsg_AttachGuest_ACK? | 81 // GuestViewMsg_AttachGuest_ACK? |
| 82 GuestViewMsg_GuestAttached::Param param; | 82 GuestViewMsg_GuestAttached::Param param; |
| 83 if (!GuestViewMsg_GuestAttached::Read(&message, ¶m)) | 83 if (!GuestViewMsg_GuestAttached::Read(&message, ¶m)) |
| 84 return; | 84 return; |
| 85 | 85 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 container()->render_frame()->DetachGuest(container()->element_instance_id()); | 127 container()->render_frame()->DetachGuest(container()->element_instance_id()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void GuestViewDetachRequest::HandleResponse(const IPC::Message& message) { | 130 void GuestViewDetachRequest::HandleResponse(const IPC::Message& message) { |
| 131 DCHECK(message.type() == GuestViewMsg_GuestDetached::ID); | 131 DCHECK(message.type() == GuestViewMsg_GuestDetached::ID); |
| 132 ExecuteCallbackIfAvailable(0 /* argc */, nullptr); | 132 ExecuteCallbackIfAvailable(0 /* argc */, nullptr); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace guest_view | 135 } // namespace guest_view |
| OLD | NEW |