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