| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 struct ResourceResponse; | 89 struct ResourceResponse; |
| 90 | 90 |
| 91 // Flag arguments for RenderFrameHost creation. | 91 // Flag arguments for RenderFrameHost creation. |
| 92 enum CreateRenderFrameFlags { | 92 enum CreateRenderFrameFlags { |
| 93 // The RFH will be initially placed on the swapped out hosts list. | 93 // The RFH will be initially placed on the swapped out hosts list. |
| 94 CREATE_RF_SWAPPED_OUT = 1 << 0, | 94 CREATE_RF_SWAPPED_OUT = 1 << 0, |
| 95 // The RenderFrame is initially hidden. | 95 // The RenderFrame is initially hidden. |
| 96 CREATE_RF_HIDDEN = 1 << 1, | 96 CREATE_RF_HIDDEN = 1 << 1, |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class CONTENT_EXPORT RenderFrameHostImpl | 99 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, |
| 100 : public RenderFrameHost, | 100 public BrowserAccessibilityDelegate, |
| 101 public BrowserAccessibilityDelegate { | 101 public SiteInstanceImpl::Observer { |
| 102 public: | 102 public: |
| 103 using AXTreeSnapshotCallback = | 103 using AXTreeSnapshotCallback = |
| 104 base::Callback<void( | 104 base::Callback<void( |
| 105 const ui::AXTreeUpdate&)>; | 105 const ui::AXTreeUpdate&)>; |
| 106 | 106 |
| 107 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 107 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
| 108 // respect to swap out. | 108 // respect to swap out. |
| 109 enum RenderFrameHostImplState { | 109 enum RenderFrameHostImplState { |
| 110 // The standard state for a RFH handling the communication with an active | 110 // The standard state for a RFH handling the communication with an active |
| 111 // RenderFrame. | 111 // RenderFrame. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 bool AccessibilityViewHasFocus() const override; | 200 bool AccessibilityViewHasFocus() const override; |
| 201 gfx::Rect AccessibilityGetViewBounds() const override; | 201 gfx::Rect AccessibilityGetViewBounds() const override; |
| 202 gfx::Point AccessibilityOriginInScreen( | 202 gfx::Point AccessibilityOriginInScreen( |
| 203 const gfx::Rect& bounds) const override; | 203 const gfx::Rect& bounds) const override; |
| 204 void AccessibilityHitTest(const gfx::Point& point) override; | 204 void AccessibilityHitTest(const gfx::Point& point) override; |
| 205 void AccessibilitySetAccessibilityFocus(int acc_obj_id) override; | 205 void AccessibilitySetAccessibilityFocus(int acc_obj_id) override; |
| 206 void AccessibilityFatalError() override; | 206 void AccessibilityFatalError() override; |
| 207 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override; | 207 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override; |
| 208 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override; | 208 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override; |
| 209 | 209 |
| 210 // SiteInstanceImpl::Observer |
| 211 void RenderProcessGone(SiteInstanceImpl* site_instance) override; |
| 212 |
| 210 // Creates a RenderFrame in the renderer process. | 213 // Creates a RenderFrame in the renderer process. |
| 211 bool CreateRenderFrame(int proxy_routing_id, | 214 bool CreateRenderFrame(int proxy_routing_id, |
| 212 int opener_routing_id, | 215 int opener_routing_id, |
| 213 int parent_routing_id, | 216 int parent_routing_id, |
| 214 int previous_sibling_routing_id); | 217 int previous_sibling_routing_id); |
| 215 | 218 |
| 216 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 219 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
| 217 // the renderer process. This is currently only used for subframes. | 220 // the renderer process. This is currently only used for subframes. |
| 218 // TODO(creis): Use this for main frames as well when RVH goes away. | 221 // TODO(creis): Use this for main frames as well when RVH goes away. |
| 219 void SetRenderFrameCreated(bool created); | 222 void SetRenderFrameCreated(bool created); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 240 // Returns the pending WebUI, or null if none applies. | 243 // Returns the pending WebUI, or null if none applies. |
| 241 WebUIImpl* pending_web_ui() const { | 244 WebUIImpl* pending_web_ui() const { |
| 242 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); | 245 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); |
| 243 } | 246 } |
| 244 | 247 |
| 245 // Returns this RenderFrameHost's loading state. This method is only used by | 248 // Returns this RenderFrameHost's loading state. This method is only used by |
| 246 // FrameTreeNode. The proper way to check whether a frame is loading is to | 249 // FrameTreeNode. The proper way to check whether a frame is loading is to |
| 247 // call FrameTreeNode::IsLoading. | 250 // call FrameTreeNode::IsLoading. |
| 248 bool is_loading() const { return is_loading_; } | 251 bool is_loading() const { return is_loading_; } |
| 249 | 252 |
| 253 // Sets this RenderFrameHost loading state. This is only used in the case of |
| 254 // transfer navigations, where no DidStart/DidStopLoading notifications |
| 255 // should be sent during the transfer. |
| 256 // TODO(clamy): Remove this once PlzNavigate ships. |
| 257 void set_is_loading(bool is_loading) { is_loading_ = is_loading; } |
| 258 |
| 250 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 259 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
| 251 // or else it returns nullptr. | 260 // or else it returns nullptr. |
| 252 // If the RenderFrameHost is the page's main frame, this returns instead a | 261 // If the RenderFrameHost is the page's main frame, this returns instead a |
| 253 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 262 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
| 254 RenderWidgetHostImpl* GetRenderWidgetHost(); | 263 RenderWidgetHostImpl* GetRenderWidgetHost(); |
| 255 | 264 |
| 256 GlobalFrameRoutingId GetGlobalFrameRoutingId(); | 265 GlobalFrameRoutingId GetGlobalFrameRoutingId(); |
| 257 | 266 |
| 258 // This function is called when this is a swapped out RenderFrameHost that | 267 // This function is called when this is a swapped out RenderFrameHost that |
| 259 // lives in the same process as the parent frame. The | 268 // lives in the same process as the parent frame. The |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 529 |
| 521 // Destroys the pending WebUI and resets related data. | 530 // Destroys the pending WebUI and resets related data. |
| 522 void ClearPendingWebUI(); | 531 void ClearPendingWebUI(); |
| 523 | 532 |
| 524 // Destroys all WebUI instances and resets related data. | 533 // Destroys all WebUI instances and resets related data. |
| 525 void ClearAllWebUI(); | 534 void ClearAllWebUI(); |
| 526 | 535 |
| 527 // Returns the Mojo ImageDownloader service. | 536 // Returns the Mojo ImageDownloader service. |
| 528 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); | 537 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
| 529 | 538 |
| 539 // Resets the loading state. Following this call, the RenderFrameHost will be |
| 540 // in a non-loading state. |
| 541 void ResetLoadingState(); |
| 542 |
| 530 protected: | 543 protected: |
| 531 friend class RenderFrameHostFactory; | 544 friend class RenderFrameHostFactory; |
| 532 | 545 |
| 533 // |flags| is a combination of CreateRenderFrameFlags. | 546 // |flags| is a combination of CreateRenderFrameFlags. |
| 534 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 547 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 535 // should be the abstraction needed here, but we need RenderViewHost to pass | 548 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 536 // into WebContentsObserver::FrameDetached for now. | 549 // into WebContentsObserver::FrameDetached for now. |
| 537 RenderFrameHostImpl(SiteInstance* site_instance, | 550 RenderFrameHostImpl(SiteInstance* site_instance, |
| 538 RenderViewHostImpl* render_view_host, | 551 RenderViewHostImpl* render_view_host, |
| 539 RenderFrameHostDelegate* delegate, | 552 RenderFrameHostDelegate* delegate, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 565 const GURL& url, | 578 const GURL& url, |
| 566 const base::TimeTicks& navigation_start); | 579 const base::TimeTicks& navigation_start); |
| 567 void OnDidFailProvisionalLoadWithError( | 580 void OnDidFailProvisionalLoadWithError( |
| 568 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params); | 581 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params); |
| 569 void OnDidFailLoadWithError( | 582 void OnDidFailLoadWithError( |
| 570 const GURL& url, | 583 const GURL& url, |
| 571 int error_code, | 584 int error_code, |
| 572 const base::string16& error_description, | 585 const base::string16& error_description, |
| 573 bool was_ignored_by_handler); | 586 bool was_ignored_by_handler); |
| 574 void OnDidCommitProvisionalLoad(const IPC::Message& msg); | 587 void OnDidCommitProvisionalLoad(const IPC::Message& msg); |
| 575 void OnDidDropNavigation(); | |
| 576 void OnUpdateState(const PageState& state); | 588 void OnUpdateState(const PageState& state); |
| 577 void OnBeforeUnloadACK( | 589 void OnBeforeUnloadACK( |
| 578 bool proceed, | 590 bool proceed, |
| 579 const base::TimeTicks& renderer_before_unload_start_time, | 591 const base::TimeTicks& renderer_before_unload_start_time, |
| 580 const base::TimeTicks& renderer_before_unload_end_time); | 592 const base::TimeTicks& renderer_before_unload_end_time); |
| 581 void OnSwapOutACK(); | 593 void OnSwapOutACK(); |
| 582 void OnRenderProcessGone(int status, int error_code); | 594 void OnRenderProcessGone(int status, int error_code); |
| 583 void OnContextMenu(const ContextMenuParams& params); | 595 void OnContextMenu(const ContextMenuParams& params); |
| 584 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); | 596 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); |
| 585 void OnVisualStateResponse(uint64_t id); | 597 void OnVisualStateResponse(uint64_t id); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 906 |
| 895 // NOTE: This must be the last member. | 907 // NOTE: This must be the last member. |
| 896 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 908 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 897 | 909 |
| 898 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 910 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 899 }; | 911 }; |
| 900 | 912 |
| 901 } // namespace content | 913 } // namespace content |
| 902 | 914 |
| 903 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 915 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |