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 : public RenderFrameHost, | 99 class CONTENT_EXPORT RenderFrameHostImpl |
100 public BrowserAccessibilityDelegate, | 100 : public RenderFrameHost, |
101 public SiteInstanceImpl::Observer { | 101 public BrowserAccessibilityDelegate { |
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 | |
213 // Creates a RenderFrame in the renderer process. | 210 // Creates a RenderFrame in the renderer process. |
214 bool CreateRenderFrame(int proxy_routing_id, | 211 bool CreateRenderFrame(int proxy_routing_id, |
215 int opener_routing_id, | 212 int opener_routing_id, |
216 int parent_routing_id, | 213 int parent_routing_id, |
217 int previous_sibling_routing_id); | 214 int previous_sibling_routing_id); |
218 | 215 |
219 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 216 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
220 // the renderer process. This is currently only used for subframes. | 217 // the renderer process. This is currently only used for subframes. |
221 // TODO(creis): Use this for main frames as well when RVH goes away. | 218 // TODO(creis): Use this for main frames as well when RVH goes away. |
222 void SetRenderFrameCreated(bool created); | 219 void SetRenderFrameCreated(bool created); |
(...skipping 20 matching lines...) Expand all Loading... |
243 // Returns the pending WebUI, or null if none applies. | 240 // Returns the pending WebUI, or null if none applies. |
244 WebUIImpl* pending_web_ui() const { | 241 WebUIImpl* pending_web_ui() const { |
245 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); | 242 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); |
246 } | 243 } |
247 | 244 |
248 // Returns this RenderFrameHost's loading state. This method is only used by | 245 // Returns this RenderFrameHost's loading state. This method is only used by |
249 // FrameTreeNode. The proper way to check whether a frame is loading is to | 246 // FrameTreeNode. The proper way to check whether a frame is loading is to |
250 // call FrameTreeNode::IsLoading. | 247 // call FrameTreeNode::IsLoading. |
251 bool is_loading() const { return is_loading_; } | 248 bool is_loading() const { return is_loading_; } |
252 | 249 |
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 | |
259 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 250 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
260 // or else it returns nullptr. | 251 // or else it returns nullptr. |
261 // If the RenderFrameHost is the page's main frame, this returns instead a | 252 // If the RenderFrameHost is the page's main frame, this returns instead a |
262 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 253 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
263 RenderWidgetHostImpl* GetRenderWidgetHost(); | 254 RenderWidgetHostImpl* GetRenderWidgetHost(); |
264 | 255 |
265 GlobalFrameRoutingId GetGlobalFrameRoutingId(); | 256 GlobalFrameRoutingId GetGlobalFrameRoutingId(); |
266 | 257 |
267 // This function is called when this is a swapped out RenderFrameHost that | 258 // This function is called when this is a swapped out RenderFrameHost that |
268 // lives in the same process as the parent frame. The | 259 // lives in the same process as the parent frame. The |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 520 |
530 // Destroys the pending WebUI and resets related data. | 521 // Destroys the pending WebUI and resets related data. |
531 void ClearPendingWebUI(); | 522 void ClearPendingWebUI(); |
532 | 523 |
533 // Destroys all WebUI instances and resets related data. | 524 // Destroys all WebUI instances and resets related data. |
534 void ClearAllWebUI(); | 525 void ClearAllWebUI(); |
535 | 526 |
536 // Returns the Mojo ImageDownloader service. | 527 // Returns the Mojo ImageDownloader service. |
537 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); | 528 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
538 | 529 |
539 // Resets the loading state. Following this call, the RenderFrameHost will be | |
540 // in a non-loading state. | |
541 void ResetLoadingState(); | |
542 | |
543 protected: | 530 protected: |
544 friend class RenderFrameHostFactory; | 531 friend class RenderFrameHostFactory; |
545 | 532 |
546 // |flags| is a combination of CreateRenderFrameFlags. | 533 // |flags| is a combination of CreateRenderFrameFlags. |
547 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 534 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
548 // should be the abstraction needed here, but we need RenderViewHost to pass | 535 // should be the abstraction needed here, but we need RenderViewHost to pass |
549 // into WebContentsObserver::FrameDetached for now. | 536 // into WebContentsObserver::FrameDetached for now. |
550 RenderFrameHostImpl(SiteInstance* site_instance, | 537 RenderFrameHostImpl(SiteInstance* site_instance, |
551 RenderViewHostImpl* render_view_host, | 538 RenderViewHostImpl* render_view_host, |
552 RenderFrameHostDelegate* delegate, | 539 RenderFrameHostDelegate* delegate, |
(...skipping 25 matching lines...) Expand all Loading... |
578 const GURL& url, | 565 const GURL& url, |
579 const base::TimeTicks& navigation_start); | 566 const base::TimeTicks& navigation_start); |
580 void OnDidFailProvisionalLoadWithError( | 567 void OnDidFailProvisionalLoadWithError( |
581 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params); | 568 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params); |
582 void OnDidFailLoadWithError( | 569 void OnDidFailLoadWithError( |
583 const GURL& url, | 570 const GURL& url, |
584 int error_code, | 571 int error_code, |
585 const base::string16& error_description, | 572 const base::string16& error_description, |
586 bool was_ignored_by_handler); | 573 bool was_ignored_by_handler); |
587 void OnDidCommitProvisionalLoad(const IPC::Message& msg); | 574 void OnDidCommitProvisionalLoad(const IPC::Message& msg); |
| 575 void OnDidDropNavigation(); |
588 void OnUpdateState(const PageState& state); | 576 void OnUpdateState(const PageState& state); |
589 void OnBeforeUnloadACK( | 577 void OnBeforeUnloadACK( |
590 bool proceed, | 578 bool proceed, |
591 const base::TimeTicks& renderer_before_unload_start_time, | 579 const base::TimeTicks& renderer_before_unload_start_time, |
592 const base::TimeTicks& renderer_before_unload_end_time); | 580 const base::TimeTicks& renderer_before_unload_end_time); |
593 void OnSwapOutACK(); | 581 void OnSwapOutACK(); |
594 void OnRenderProcessGone(int status, int error_code); | 582 void OnRenderProcessGone(int status, int error_code); |
595 void OnContextMenu(const ContextMenuParams& params); | 583 void OnContextMenu(const ContextMenuParams& params); |
596 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); | 584 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); |
597 void OnVisualStateResponse(uint64_t id); | 585 void OnVisualStateResponse(uint64_t id); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 | 894 |
907 // NOTE: This must be the last member. | 895 // NOTE: This must be the last member. |
908 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 896 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
909 | 897 |
910 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 898 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
911 }; | 899 }; |
912 | 900 |
913 } // namespace content | 901 } // namespace content |
914 | 902 |
915 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 903 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |