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