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