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