Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/frame_host/render_frame_proxy_host.h" | 5 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/frame_tree_node.h" | |
| 7 #include "content/browser/frame_host/render_frame_host_impl.h" | 8 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 8 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/common/frame_messages.h" | |
| 11 #include "ipc/ipc_message.h" | |
| 9 | 12 |
| 10 namespace content { | 13 namespace content { |
| 11 | 14 |
| 12 RenderFrameProxyHost::RenderFrameProxyHost( | 15 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance, |
| 13 scoped_ptr<RenderFrameHostImpl> render_frame_host) | 16 FrameTreeNode* frame_tree_node) |
| 14 : site_instance_(render_frame_host->GetSiteInstance()), | 17 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()), |
| 15 render_frame_host_(render_frame_host.Pass()) {} | 18 site_instance_(site_instance), |
| 19 frame_tree_node_(frame_tree_node) { | |
| 20 GetProcess()->AddRoute(routing_id_, this); | |
| 21 } | |
| 16 | 22 |
| 17 RenderFrameProxyHost::~RenderFrameProxyHost() {} | 23 RenderFrameProxyHost::~RenderFrameProxyHost() { |
| 24 GetProcess()->RemoveRoute(routing_id_); | |
| 25 } | |
| 26 | |
| 27 void RenderFrameProxyHost::DeleteRendererProxy() { | |
| 28 Send(new FrameMsg_DeleteProxy(routing_id_)); | |
| 29 } | |
| 30 | |
| 31 bool RenderFrameProxyHost::Send(IPC::Message *msg) { | |
| 32 // TODO(nasko): For now, RenderFrameHost uses this object to send IPC messages | |
| 33 // while in swapped out state. Once the swapped out state is removed, it | |
| 34 // no longer needs to overwrite the routing id. | |
| 35 msg->set_routing_id(routing_id_); | |
| 36 return GetProcess()->Send(msg); | |
| 37 } | |
| 38 | |
| 39 bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { | |
| 40 // TODO(nasko): Remove this forward as soon as swapping out of | |
| 41 // RenderFrameHosts is removed. | |
| 42 if (render_frame_host_.get()) { | |
|
Charlie Reis
2014/05/15 00:32:50
nit: No braces needed.
nasko
2014/05/15 18:47:13
Done.
| |
| 43 return render_frame_host_->OnMessageReceived(msg); | |
| 44 } | |
| 45 return false; | |
| 46 } | |
| 18 | 47 |
| 19 } // namespace content | 48 } // namespace content |
| OLD | NEW |