| 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 the root |
| 86 // of a subtree of frames that are being rendered in the same process. |
| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // after they are blocked in RenderWidgetHelper::CreateNewWindow. | 188 // after they are blocked in RenderWidgetHelper::CreateNewWindow. |
| 183 void Init(); | 189 void Init(); |
| 184 | 190 |
| 185 int routing_id() const { return routing_id_; } | 191 int routing_id() const { return routing_id_; } |
| 186 void OnCreateChildFrame(int new_routing_id, | 192 void OnCreateChildFrame(int new_routing_id, |
| 187 const std::string& frame_name); | 193 const std::string& frame_name); |
| 188 | 194 |
| 189 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 195 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
| 190 RenderFrameHostDelegate* delegate() { return delegate_; } | 196 RenderFrameHostDelegate* delegate() { return delegate_; } |
| 191 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 197 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
| 192 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in | 198 |
| 193 // the future, so update this accessor to return the right pointer. | 199 // This is called to create RenderWidgetHosts for out-of-process iframes. |
| 200 void CreateRenderWidgetHost(RenderWidgetHostDelegate* delegate, |
| 201 bool hidden); |
| 202 |
| 203 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
| 204 // or else it returns a pointer to the RenderViewHost (which inherits |
| 205 // 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 402 |
| 387 protected: | 403 protected: |
| 388 friend class RenderFrameHostFactory; | 404 friend class RenderFrameHostFactory; |
| 389 | 405 |
| 390 // |flags| is a combination of CreateRenderFrameFlags. | 406 // |flags| is a combination of CreateRenderFrameFlags. |
| 391 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 407 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 392 // should be the abstraction needed here, but we need RenderViewHost to pass | 408 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 393 // into WebContentsObserver::FrameDetached for now. | 409 // into WebContentsObserver::FrameDetached for now. |
| 394 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, | 410 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
| 395 RenderFrameHostDelegate* delegate, | 411 RenderFrameHostDelegate* delegate, |
| 412 RenderWidgetHostDelegate* rwh_delegate, |
| 396 FrameTree* frame_tree, | 413 FrameTree* frame_tree, |
| 397 FrameTreeNode* frame_tree_node, | 414 FrameTreeNode* frame_tree_node, |
| 398 int routing_id, | 415 int routing_id, |
| 399 int flags); | 416 int flags); |
| 400 | 417 |
| 401 private: | 418 private: |
| 402 friend class TestRenderFrameHost; | 419 friend class TestRenderFrameHost; |
| 403 friend class TestRenderViewHost; | 420 friend class TestRenderViewHost; |
| 404 | 421 |
| 405 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); | 422 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // messages from the renderer requesting DOM manipulation. | 542 // messages from the renderer requesting DOM manipulation. |
| 526 FrameTree* frame_tree_; | 543 FrameTree* frame_tree_; |
| 527 | 544 |
| 528 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. | 545 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. |
| 529 FrameTreeNode* frame_tree_node_; | 546 FrameTreeNode* frame_tree_node_; |
| 530 | 547 |
| 531 // The mapping of pending JavaScript calls created by | 548 // The mapping of pending JavaScript calls created by |
| 532 // ExecuteJavaScript and their corresponding callbacks. | 549 // ExecuteJavaScript and their corresponding callbacks. |
| 533 std::map<int, JavaScriptResultCallback> javascript_callbacks_; | 550 std::map<int, JavaScriptResultCallback> javascript_callbacks_; |
| 534 | 551 |
| 552 // Map from notification_id to a callback to cancel them. |
| 553 std::map<int, base::Closure> cancel_notification_callbacks_; |
| 554 |
| 555 // RenderFrameHosts that need management of the rendering and input events |
| 556 // for their frame subtrees require RenderWidgetHosts. This typically |
| 557 // means frames that are rendered in different processes from their parent |
| 558 // frames. |
| 559 // TODO(kenrb): Later this will also be used on the top-level frame. |
| 560 scoped_ptr<RenderWidgetHostImpl> render_widget_host_; |
| 561 |
| 535 int routing_id_; | 562 int routing_id_; |
| 536 | 563 |
| 537 // The current state of this RenderFrameHost. | 564 // The current state of this RenderFrameHost. |
| 538 RenderFrameHostImplState rfh_state_; | 565 RenderFrameHostImplState rfh_state_; |
| 539 | 566 |
| 540 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 567 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
| 541 // the renderer process. Currently only used for subframes. | 568 // the renderer process. Currently only used for subframes. |
| 542 // TODO(creis): Use this for main frames as well when RVH goes away. | 569 // TODO(creis): Use this for main frames as well when RVH goes away. |
| 543 bool render_frame_created_; | 570 bool render_frame_created_; |
| 544 | 571 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 640 |
| 614 // NOTE: This must be the last member. | 641 // NOTE: This must be the last member. |
| 615 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 642 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 616 | 643 |
| 617 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 644 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 618 }; | 645 }; |
| 619 | 646 |
| 620 } // namespace content | 647 } // namespace content |
| 621 | 648 |
| 622 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 649 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |