| Index: components/framelet/renderer/framelet_container.cc
|
| diff --git a/components/framelet/renderer/framelet_container.cc b/components/framelet/renderer/framelet_container.cc
|
| index 1938067af88ce6e328349000424c255d734584c9..62c73a6c04da0838a02fd3c07847815b83b028ec 100644
|
| --- a/components/framelet/renderer/framelet_container.cc
|
| +++ b/components/framelet/renderer/framelet_container.cc
|
| @@ -4,9 +4,70 @@
|
|
|
| #include "components/framelet/renderer/framelet_container.h"
|
|
|
| +#include "components/framelet/common/framelet_messages.h"
|
| +#include "components/guest_view/common/guest_view_constants.h"
|
| +#include "components/guest_view/common/guest_view_messages.h"
|
| +#include "content/public/renderer/render_frame.h"
|
| +#include "content/public/renderer/render_view.h"
|
| +#include "third_party/WebKit/public/web/WebDocument.h"
|
| +#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
| +
|
| namespace guest_view {
|
|
|
| FrameletContainer::FrameletContainer(content::RenderFrame* render_frame)
|
| - : GuestViewContainer(render_frame) {}
|
| + : GuestViewContainer(render_frame),
|
| + guest_proxy_routing_id_(-1) {
|
| + is_embedded_ = !render_frame->GetWebFrame()->document().isPluginDocument();
|
| +}
|
| +
|
| +bool FrameletContainer::OnMessage(const IPC::Message& message) {
|
| + bool handled = true;
|
| + IPC_BEGIN_MESSAGE_MAP(FrameletContainer, message);
|
| + IPC_MESSAGE_HANDLER(FrameletGuestViewMsg_CreateFrameletGuestACK,
|
| + OnCreateFrameletGuestACK);
|
| + IPC_MESSAGE_HANDLER(GuestViewMsg_GuestAttached,
|
| + OnGuestAttached);
|
| + IPC_MESSAGE_UNHANDLED(handled = false);
|
| + IPC_END_MESSAGE_MAP();
|
| + return handled;
|
| +}
|
| +
|
| +void FrameletContainer::OnCreateFrameletGuestACK(int element_instance_id) {
|
| + DCHECK_NE(this->element_instance_id(), guest_view::kInstanceIDNone);
|
| + DCHECK_EQ(this->element_instance_id(), element_instance_id);
|
| +
|
| + if (!render_frame())
|
| + return;
|
| +
|
| + render_frame()->AttachGuest(element_instance_id);
|
| +}
|
| +
|
| +void FrameletContainer::OnGuestAttached(int /* unused */,
|
| + int guest_proxy_routing_id) {
|
| + guest_proxy_routing_id_ = guest_proxy_routing_id;
|
| +}
|
| +
|
| +void FrameletContainer::DidResizeElement(const gfx::Size& new_size) {
|
| + element_size_ = new_size;
|
| + // TODO(wjmaclean): MimeHandlerViewGuest sends a message to the viewhost to
|
| + // notify when the size has changed. Should we?
|
| +}
|
| +
|
| +void FrameletContainer::DidFinishLoading() {
|
| + DCHECK(!is_embedded_);
|
| + CreateFrameletGuest();
|
| +}
|
| +
|
| +void FrameletContainer::CreateFrameletGuest() {
|
| + // TODO(wjmaclean): figure out how to get url_ and element_size_.
|
| + DCHECK_NE(element_instance_id(), guest_view::kInstanceIDNone);
|
| +
|
| + if (!render_frame())
|
| + return;
|
| +
|
| + render_frame()->Send(new FrameletGuestViewHostMsg_CreateFrameletGuest(
|
| + render_frame()->GetRoutingID(), url_,
|
| + element_instance_id(), element_size_));
|
| +}
|
|
|
| } // namespace guest_view
|
|
|