render_frame_host_impl.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
1// Copyright 2013 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. 4 5#ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6#define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 7 8#include <string> 9 10#include "base/compiler_specific.h" 11#include "content/public/browser/render_frame_host.h" 12 13class GURL; 14 15namespace content { 16 17class FrameTree; 18class RenderProcessHost; 19class RenderViewHostImpl; 20 21class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { 22 public: 23 static RenderFrameHostImpl* FromID(int process_id, int routing_id); 24 25 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 26 // should be the abstraction needed here, but we need RenderViewHost to pass 27 // into WebContentsObserver::FrameDetached for now. 28 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 29 FrameTree* frame_tree, 30 int routing_id, 31 bool is_swapped_out); 32 virtual ~RenderFrameHostImpl(); 33 34 // IPC::Sender 35 virtual bool Send(IPC::Message* msg) OVERRIDE; 36 37 // IPC::Listener 38 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 39 40 void Init(); 41 RenderProcessHost* GetProcess() const; 42 int routing_id() const { return routing_id_; } 43 void OnCreateChildFrame(int new_frame_routing_id, 44 int64 parent_frame_id, 45 int64 frame_id, 46 const std::string& frame_name); 47 48 RenderViewHostImpl* render_view_host() { 49 return render_view_host_; 50 } 51 52 private: 53 // IPC Message handlers. 54 void OnDetach(int64 parent_frame_id, int64 frame_id); 55 void OnDidStartProvisionalLoadForFrame(int64 frame_id, 56 int64 parent_frame_id, 57 bool main_frame, 58 const GURL& url); 59 60 bool is_swapped_out() { return is_swapped_out_; } 61 62 // TODO(nasko): This should be removed and replaced by RenderProcessHost. 63 RenderViewHostImpl* render_view_host_; // Not owned. 64 65 // Reference to the whole frame tree that this RenderFrameHost belongs too. 66 // Allows this RenderFrameHost to add and remove nodes in response to 67 // messages from the renderer requesting DOM manipulation. 68 FrameTree* frame_tree_; 69 int routing_id_; 70 bool is_swapped_out_; 71 72 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 73}; 74 75} // namespace content 76 77#endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 78