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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 class CrossProcessFrameConnector; | 54 class CrossProcessFrameConnector; |
55 class CrossSiteTransferringRequest; | 55 class CrossSiteTransferringRequest; |
56 class FrameTree; | 56 class FrameTree; |
57 class FrameTreeNode; | 57 class FrameTreeNode; |
58 class PermissionServiceContext; | 58 class PermissionServiceContext; |
59 class RenderFrameHostDelegate; | 59 class RenderFrameHostDelegate; |
60 class RenderFrameProxyHost; | 60 class RenderFrameProxyHost; |
61 class RenderProcessHost; | 61 class RenderProcessHost; |
62 class RenderViewHostImpl; | 62 class RenderViewHostImpl; |
63 class RenderWidgetHostDelegate; | |
64 class RenderWidgetHostImpl; | 63 class RenderWidgetHostImpl; |
65 class RenderWidgetHostView; | |
66 class StreamHandle; | 64 class StreamHandle; |
67 class TimeoutMonitor; | 65 class TimeoutMonitor; |
68 struct CommitNavigationParams; | 66 struct CommitNavigationParams; |
69 struct CommonNavigationParams; | 67 struct CommonNavigationParams; |
70 struct ContextMenuParams; | 68 struct ContextMenuParams; |
71 struct GlobalRequestID; | 69 struct GlobalRequestID; |
72 struct Referrer; | 70 struct Referrer; |
73 struct ResourceResponse; | 71 struct ResourceResponse; |
74 struct TransitionLayerData; | 72 struct TransitionLayerData; |
75 | 73 |
76 // Flag arguments for RenderFrameHost creation. | 74 // Flag arguments for RenderFrameHost creation. |
77 enum CreateRenderFrameFlags { | 75 enum CreateRenderFrameFlags { |
78 // The RFH will be initially placed on the swapped out hosts list. | 76 // The RFH will be initially placed on the swapped out hosts list. |
79 CREATE_RF_SWAPPED_OUT = 1 << 0, | 77 CREATE_RF_SWAPPED_OUT = 1 << 0, |
80 // The new RenderFrame is being created for a navigation of the | 78 // The new RenderFrame is being created for a navigation of the |
81 // top-level frame. | 79 // top-level frame. |
82 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION = 1 << 1, | 80 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION = 1 << 1, |
83 // The RenderFrame is initially hidden. | 81 // The RenderFrame is initially hidden. |
84 CREATE_RF_HIDDEN = 1 << 2, | 82 CREATE_RF_HIDDEN = 1 << 2 |
85 // The RenderFrameHost will have a new RenderWidgetHost created and | |
86 // attached to it. This is used when the RenderFrameHost is in a different | |
87 // process from its parent frame. | |
88 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 | |
89 }; | 83 }; |
90 | 84 |
91 class CONTENT_EXPORT RenderFrameHostImpl | 85 class CONTENT_EXPORT RenderFrameHostImpl |
92 : public RenderFrameHost, | 86 : public RenderFrameHost, |
93 public BrowserAccessibilityDelegate { | 87 public BrowserAccessibilityDelegate { |
94 public: | 88 public: |
95 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 89 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
96 // respect to swap out. | 90 // respect to swap out. |
97 enum RenderFrameHostImplState { | 91 enum RenderFrameHostImplState { |
98 // The standard state for a RFH handling the communication with an active | 92 // The standard state for a RFH handling the communication with an active |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // cross-process subframe navigations in --site-per-process. | 170 // cross-process subframe navigations in --site-per-process. |
177 bool CreateRenderFrame(int parent_routing_id, int proxy_routing_id); | 171 bool CreateRenderFrame(int parent_routing_id, int proxy_routing_id); |
178 | 172 |
179 // Returns whether the RenderFrame in the renderer process has been created | 173 // Returns whether the RenderFrame in the renderer process has been created |
180 // and still has a connection. This is valid for all frames. | 174 // and still has a connection. This is valid for all frames. |
181 bool IsRenderFrameLive(); | 175 bool IsRenderFrameLive(); |
182 | 176 |
183 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 177 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
184 // the renderer process. This is currently only used for subframes. | 178 // the renderer process. This is currently only used for subframes. |
185 // TODO(creis): Use this for main frames as well when RVH goes away. | 179 // TODO(creis): Use this for main frames as well when RVH goes away. |
186 void SetRenderFrameCreated(bool created); | 180 void set_render_frame_created(bool created) { |
| 181 render_frame_created_ = created; |
| 182 } |
187 | 183 |
188 // Called for renderer-created windows to resume requests from this frame, | 184 // Called for renderer-created windows to resume requests from this frame, |
189 // after they are blocked in RenderWidgetHelper::CreateNewWindow. | 185 // after they are blocked in RenderWidgetHelper::CreateNewWindow. |
190 void Init(); | 186 void Init(); |
191 | 187 |
192 int routing_id() const { return routing_id_; } | 188 int routing_id() const { return routing_id_; } |
193 void OnCreateChildFrame(int new_routing_id, | 189 void OnCreateChildFrame(int new_routing_id, |
194 const std::string& frame_name, | 190 const std::string& frame_name, |
195 SandboxFlags sandbox_flags); | 191 SandboxFlags sandbox_flags); |
196 | 192 |
197 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 193 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
198 RenderFrameHostDelegate* delegate() { return delegate_; } | 194 RenderFrameHostDelegate* delegate() { return delegate_; } |
199 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 195 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
200 | 196 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in |
201 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 197 // the future, so update this accessor to return the right pointer. |
202 // or else it returns nullptr. | |
203 // If the RenderFrameHost is the page's main frame, this returns instead a | |
204 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | |
205 RenderWidgetHostImpl* GetRenderWidgetHost(); | 198 RenderWidgetHostImpl* GetRenderWidgetHost(); |
206 | 199 |
207 // This returns the RenderWidgetHostView that can be used to control | |
208 // focus and visibility for this frame. | |
209 RenderWidgetHostView* GetView(); | |
210 | |
211 // This function is called when this is a swapped out RenderFrameHost that | 200 // This function is called when this is a swapped out RenderFrameHost that |
212 // lives in the same process as the parent frame. The | 201 // lives in the same process as the parent frame. The |
213 // |cross_process_frame_connector| allows the non-swapped-out | 202 // |cross_process_frame_connector| allows the non-swapped-out |
214 // RenderFrameHost for a frame to communicate with the parent process | 203 // RenderFrameHost for a frame to communicate with the parent process |
215 // so that it may composite drawing data. | 204 // so that it may composite drawing data. |
216 // | 205 // |
217 // Ownership is not transfered. | 206 // Ownership is not transfered. |
218 void set_cross_process_frame_connector( | 207 void set_cross_process_frame_connector( |
219 CrossProcessFrameConnector* cross_process_frame_connector) { | 208 CrossProcessFrameConnector* cross_process_frame_connector) { |
220 cross_process_frame_connector_ = cross_process_frame_connector; | 209 cross_process_frame_connector_ = cross_process_frame_connector; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 394 |
406 protected: | 395 protected: |
407 friend class RenderFrameHostFactory; | 396 friend class RenderFrameHostFactory; |
408 | 397 |
409 // |flags| is a combination of CreateRenderFrameFlags. | 398 // |flags| is a combination of CreateRenderFrameFlags. |
410 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 399 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
411 // should be the abstraction needed here, but we need RenderViewHost to pass | 400 // should be the abstraction needed here, but we need RenderViewHost to pass |
412 // into WebContentsObserver::FrameDetached for now. | 401 // into WebContentsObserver::FrameDetached for now. |
413 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, | 402 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
414 RenderFrameHostDelegate* delegate, | 403 RenderFrameHostDelegate* delegate, |
415 RenderWidgetHostDelegate* rwh_delegate, | |
416 FrameTree* frame_tree, | 404 FrameTree* frame_tree, |
417 FrameTreeNode* frame_tree_node, | 405 FrameTreeNode* frame_tree_node, |
418 int routing_id, | 406 int routing_id, |
419 int flags); | 407 int flags); |
420 | 408 |
421 private: | 409 private: |
422 friend class TestRenderFrameHost; | 410 friend class TestRenderFrameHost; |
423 friend class TestRenderViewHost; | 411 friend class TestRenderViewHost; |
424 | 412 |
425 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); | 413 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // messages from the renderer requesting DOM manipulation. | 539 // messages from the renderer requesting DOM manipulation. |
552 FrameTree* frame_tree_; | 540 FrameTree* frame_tree_; |
553 | 541 |
554 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. | 542 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. |
555 FrameTreeNode* frame_tree_node_; | 543 FrameTreeNode* frame_tree_node_; |
556 | 544 |
557 // The mapping of pending JavaScript calls created by | 545 // The mapping of pending JavaScript calls created by |
558 // ExecuteJavaScript and their corresponding callbacks. | 546 // ExecuteJavaScript and their corresponding callbacks. |
559 std::map<int, JavaScriptResultCallback> javascript_callbacks_; | 547 std::map<int, JavaScriptResultCallback> javascript_callbacks_; |
560 | 548 |
561 // RenderFrameHosts that need management of the rendering and input events | |
562 // for their frame subtrees require RenderWidgetHosts. This typically | |
563 // means frames that are rendered in different processes from their parent | |
564 // frames. | |
565 // TODO(kenrb): Later this will also be used on the top-level frame, when | |
566 // RenderFrameHost owns its RenderViewHost. | |
567 scoped_ptr<RenderWidgetHostImpl> render_widget_host_; | |
568 | |
569 int routing_id_; | 549 int routing_id_; |
570 | 550 |
571 // The current state of this RenderFrameHost. | 551 // The current state of this RenderFrameHost. |
572 RenderFrameHostImplState rfh_state_; | 552 RenderFrameHostImplState rfh_state_; |
573 | 553 |
574 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 554 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
575 // the renderer process. Currently only used for subframes. | 555 // the renderer process. Currently only used for subframes. |
576 // TODO(creis): Use this for main frames as well when RVH goes away. | 556 // TODO(creis): Use this for main frames as well when RVH goes away. |
577 bool render_frame_created_; | 557 bool render_frame_created_; |
578 | 558 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 627 |
648 // NOTE: This must be the last member. | 628 // NOTE: This must be the last member. |
649 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 629 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
650 | 630 |
651 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 631 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
652 }; | 632 }; |
653 | 633 |
654 } // namespace content | 634 } // namespace content |
655 | 635 |
656 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 636 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |