| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 namespace content { | 46 namespace content { |
| 47 | 47 |
| 48 class CrossProcessFrameConnector; | 48 class CrossProcessFrameConnector; |
| 49 class CrossSiteTransferringRequest; | 49 class CrossSiteTransferringRequest; |
| 50 class FrameTree; | 50 class FrameTree; |
| 51 class FrameTreeNode; | 51 class FrameTreeNode; |
| 52 class RenderFrameHostDelegate; | 52 class RenderFrameHostDelegate; |
| 53 class RenderFrameProxyHost; | 53 class RenderFrameProxyHost; |
| 54 class RenderProcessHost; | 54 class RenderProcessHost; |
| 55 class RenderViewHostImpl; | 55 class RenderViewHostImpl; |
| 56 class RenderWidgetHostDelegate; |
| 56 class RenderWidgetHostImpl; | 57 class RenderWidgetHostImpl; |
| 58 class RenderWidgetHostView; |
| 57 class StreamHandle; | 59 class StreamHandle; |
| 58 class TimeoutMonitor; | 60 class TimeoutMonitor; |
| 59 struct CommitNavigationParams; | 61 struct CommitNavigationParams; |
| 60 struct ContextMenuParams; | 62 struct ContextMenuParams; |
| 61 struct CommonNavigationParams; | 63 struct CommonNavigationParams; |
| 62 struct GlobalRequestID; | 64 struct GlobalRequestID; |
| 63 struct Referrer; | 65 struct Referrer; |
| 64 struct RequestNavigationParams; | 66 struct RequestNavigationParams; |
| 65 struct ResourceResponse; | 67 struct ResourceResponse; |
| 66 struct ShowDesktopNotificationHostMsgParams; | 68 struct ShowDesktopNotificationHostMsgParams; |
| 67 struct TransitionLayerData; | 69 struct TransitionLayerData; |
| 68 | 70 |
| 71 // Flag arguments for RenderFrameHost creation. |
| 72 enum CreateRenderFrameFlags { |
| 73 // The RFH will be initially placed on the swapped out hosts list. |
| 74 SWAPPED_OUT = 1 << 0, |
| 75 // The new RenderFrame is being created for a navigation of the |
| 76 // top-level frame. |
| 77 FOR_MAIN_FRAME_NAVIGATION = 1 << 1, |
| 78 // The RenderFrame is initially hidden. |
| 79 HIDDEN = 1 << 2, |
| 80 // The RenderFrameHost will have a new RenderWidgetHost created and |
| 81 // attached to it. This is used when the RenderFrameHost is the root |
| 82 // of a subtree of frames that are being rendered in the same process. |
| 83 CREATE_RENDER_WIDGET_HOST = 1 << 3 |
| 84 }; |
| 85 |
| 69 class CONTENT_EXPORT RenderFrameHostImpl | 86 class CONTENT_EXPORT RenderFrameHostImpl |
| 70 : public RenderFrameHost, | 87 : public RenderFrameHost, |
| 71 public BrowserAccessibilityDelegate { | 88 public BrowserAccessibilityDelegate { |
| 72 public: | 89 public: |
| 73 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 90 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
| 74 // respect to swap out. | 91 // respect to swap out. |
| 75 enum RenderFrameHostImplState { | 92 enum RenderFrameHostImplState { |
| 76 // The standard state for a RFH handling the communication with an active | 93 // The standard state for a RFH handling the communication with an active |
| 77 // RenderFrame. | 94 // RenderFrame. |
| 78 STATE_DEFAULT = 0, | 95 STATE_DEFAULT = 0, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // after they are blocked in RenderWidgetHelper::CreateNewWindow. | 178 // after they are blocked in RenderWidgetHelper::CreateNewWindow. |
| 162 void Init(); | 179 void Init(); |
| 163 | 180 |
| 164 int routing_id() const { return routing_id_; } | 181 int routing_id() const { return routing_id_; } |
| 165 void OnCreateChildFrame(int new_routing_id, | 182 void OnCreateChildFrame(int new_routing_id, |
| 166 const std::string& frame_name); | 183 const std::string& frame_name); |
| 167 | 184 |
| 168 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 185 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
| 169 RenderFrameHostDelegate* delegate() { return delegate_; } | 186 RenderFrameHostDelegate* delegate() { return delegate_; } |
| 170 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 187 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
| 171 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in | 188 |
| 172 // the future, so update this accessor to return the right pointer. | 189 // This is called to create RenderWidgetHosts for out-of-process iframes. |
| 190 void CreateRenderWidgetHost(RenderWidgetHostDelegate* delegate, |
| 191 bool hidden); |
| 192 |
| 193 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
| 194 // or else it returns a pointer to the RenderViewHost (which inherits |
| 195 // RenderWidgetHost). |
| 173 RenderWidgetHostImpl* GetRenderWidgetHost(); | 196 RenderWidgetHostImpl* GetRenderWidgetHost(); |
| 174 | 197 |
| 198 // This returns the RenderWidgetHostView that can be used to control |
| 199 // focus and visibility for this frame. |
| 200 RenderWidgetHostView* GetView(); |
| 201 |
| 175 // This function is called when this is a swapped out RenderFrameHost that | 202 // This function is called when this is a swapped out RenderFrameHost that |
| 176 // lives in the same process as the parent frame. The | 203 // lives in the same process as the parent frame. The |
| 177 // |cross_process_frame_connector| allows the non-swapped-out | 204 // |cross_process_frame_connector| allows the non-swapped-out |
| 178 // RenderFrameHost for a frame to communicate with the parent process | 205 // RenderFrameHost for a frame to communicate with the parent process |
| 179 // so that it may composite drawing data. | 206 // so that it may composite drawing data. |
| 180 // | 207 // |
| 181 // Ownership is not transfered. | 208 // Ownership is not transfered. |
| 182 void set_cross_process_frame_connector( | 209 void set_cross_process_frame_connector( |
| 183 CrossProcessFrameConnector* cross_process_frame_connector) { | 210 CrossProcessFrameConnector* cross_process_frame_connector) { |
| 184 cross_process_frame_connector_ = cross_process_frame_connector; | 211 cross_process_frame_connector_ = cross_process_frame_connector; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 const CommitNavigationParams& commit_params); | 382 const CommitNavigationParams& commit_params); |
| 356 | 383 |
| 357 protected: | 384 protected: |
| 358 friend class RenderFrameHostFactory; | 385 friend class RenderFrameHostFactory; |
| 359 | 386 |
| 360 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 387 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 361 // should be the abstraction needed here, but we need RenderViewHost to pass | 388 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 362 // into WebContentsObserver::FrameDetached for now. | 389 // into WebContentsObserver::FrameDetached for now. |
| 363 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, | 390 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
| 364 RenderFrameHostDelegate* delegate, | 391 RenderFrameHostDelegate* delegate, |
| 392 RenderWidgetHostDelegate* rwh_delegate, |
| 365 FrameTree* frame_tree, | 393 FrameTree* frame_tree, |
| 366 FrameTreeNode* frame_tree_node, | 394 FrameTreeNode* frame_tree_node, |
| 367 int routing_id, | 395 int routing_id, |
| 368 bool is_swapped_out); | 396 int flags); |
| 369 | 397 |
| 370 private: | 398 private: |
| 371 friend class TestRenderFrameHost; | 399 friend class TestRenderFrameHost; |
| 372 friend class TestRenderViewHost; | 400 friend class TestRenderViewHost; |
| 373 | 401 |
| 374 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); | 402 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); |
| 375 | 403 |
| 376 // IPC Message handlers. | 404 // IPC Message handlers. |
| 377 void OnAddMessageToConsole(int32 level, | 405 void OnAddMessageToConsole(int32 level, |
| 378 const base::string16& message, | 406 const base::string16& message, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. | 523 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. |
| 496 FrameTreeNode* frame_tree_node_; | 524 FrameTreeNode* frame_tree_node_; |
| 497 | 525 |
| 498 // The mapping of pending JavaScript calls created by | 526 // The mapping of pending JavaScript calls created by |
| 499 // ExecuteJavaScript and their corresponding callbacks. | 527 // ExecuteJavaScript and their corresponding callbacks. |
| 500 std::map<int, JavaScriptResultCallback> javascript_callbacks_; | 528 std::map<int, JavaScriptResultCallback> javascript_callbacks_; |
| 501 | 529 |
| 502 // Map from notification_id to a callback to cancel them. | 530 // Map from notification_id to a callback to cancel them. |
| 503 std::map<int, base::Closure> cancel_notification_callbacks_; | 531 std::map<int, base::Closure> cancel_notification_callbacks_; |
| 504 | 532 |
| 533 // RenderFrameHosts that need management of the rendering and input events |
| 534 // for their frame subtrees require RenderWidgetHosts. This typically |
| 535 // means frames that are rendered in different processes from their parent |
| 536 // frames. |
| 537 // TODO(kenrb): Later this will also be used on the top-level frame. |
| 538 scoped_ptr<RenderWidgetHostImpl> render_widget_host_; |
| 539 |
| 505 int routing_id_; | 540 int routing_id_; |
| 506 | 541 |
| 507 // The current state of this RenderFrameHost. | 542 // The current state of this RenderFrameHost. |
| 508 RenderFrameHostImplState rfh_state_; | 543 RenderFrameHostImplState rfh_state_; |
| 509 | 544 |
| 510 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 545 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
| 511 // the renderer process. Currently only used for subframes. | 546 // the renderer process. Currently only used for subframes. |
| 512 // TODO(creis): Use this for main frames as well when RVH goes away. | 547 // TODO(creis): Use this for main frames as well when RVH goes away. |
| 513 bool render_frame_created_; | 548 bool render_frame_created_; |
| 514 | 549 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 594 |
| 560 // NOTE: This must be the last member. | 595 // NOTE: This must be the last member. |
| 561 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 596 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 562 | 597 |
| 563 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 598 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 564 }; | 599 }; |
| 565 | 600 |
| 566 } // namespace content | 601 } // namespace content |
| 567 | 602 |
| 568 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 603 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |