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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // The RenderFrameHost will have a new RenderWidgetHost created and | 87 // The RenderFrameHost will have a new RenderWidgetHost created and |
88 // attached to it. This is used when the RenderFrameHost is in a different | 88 // attached to it. This is used when the RenderFrameHost is in a different |
89 // process from its parent frame. | 89 // process from its parent frame. |
90 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 | 90 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 |
91 }; | 91 }; |
92 | 92 |
93 class CONTENT_EXPORT RenderFrameHostImpl | 93 class CONTENT_EXPORT RenderFrameHostImpl |
94 : public RenderFrameHost, | 94 : public RenderFrameHost, |
95 public BrowserAccessibilityDelegate { | 95 public BrowserAccessibilityDelegate { |
96 public: | 96 public: |
| 97 // These values indicate the loading progress status. The minimum progress |
| 98 // value matches what Blink's ProgressTracker has traditionally used for a |
| 99 // minimum progress value. |
| 100 // TODO(fdegans): Move these values to the implementation when the relevant |
| 101 // IPCs are moved from WebContentsImpl to RenderFrameHost. |
| 102 static const double kLoadingProgressNotStarted; |
| 103 static const double kLoadingProgressMinimum; |
| 104 static const double kLoadingProgressDone; |
| 105 |
97 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 106 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
98 // respect to swap out. | 107 // respect to swap out. |
99 enum RenderFrameHostImplState { | 108 enum RenderFrameHostImplState { |
100 // The standard state for a RFH handling the communication with an active | 109 // The standard state for a RFH handling the communication with an active |
101 // RenderFrame. | 110 // RenderFrame. |
102 STATE_DEFAULT = 0, | 111 STATE_DEFAULT = 0, |
103 // The RFH has not received the SwapOutACK yet, but the new page has | 112 // The RFH has not received the SwapOutACK yet, but the new page has |
104 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH | 113 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH |
105 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are | 114 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are |
106 // other active frames in its SiteInstance) or it will be deleted. | 115 // other active frames in its SiteInstance) or it will be deleted. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 205 |
197 int routing_id() const { return routing_id_; } | 206 int routing_id() const { return routing_id_; } |
198 void OnCreateChildFrame(int new_routing_id, | 207 void OnCreateChildFrame(int new_routing_id, |
199 const std::string& frame_name, | 208 const std::string& frame_name, |
200 SandboxFlags sandbox_flags); | 209 SandboxFlags sandbox_flags); |
201 | 210 |
202 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 211 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
203 RenderFrameHostDelegate* delegate() { return delegate_; } | 212 RenderFrameHostDelegate* delegate() { return delegate_; } |
204 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 213 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
205 | 214 |
| 215 // Sets this RenderFrameHost's loading state. |
| 216 void set_is_loading(bool is_loading) { |
| 217 is_loading_ = is_loading; |
| 218 } |
| 219 |
| 220 // Returns this RenderFrameHost's loading state. This method is only used by |
| 221 // FrameTreeNode. The proper way to check whether a frame is loading is to |
| 222 // call FrameTreeNode::IsLoading. |
| 223 bool is_loading() const { return is_loading_; } |
| 224 |
| 225 // Sets this RenderFrameHost's loading progress (from 0 to 1). |
| 226 void set_loading_progress(double loading_progress) { |
| 227 loading_progress_ = loading_progress; |
| 228 } |
| 229 |
| 230 // Returns this RenderFrameHost's loading progress. This is only used by |
| 231 // FrameTreeNode. The proper way to check a frame loading progress is to call |
| 232 // FrameTreeNode::GetLoadingProgress. |
| 233 double loading_progress() const { return loading_progress_; } |
| 234 |
206 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 235 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
207 // or else it returns nullptr. | 236 // or else it returns nullptr. |
208 // If the RenderFrameHost is the page's main frame, this returns instead a | 237 // If the RenderFrameHost is the page's main frame, this returns instead a |
209 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 238 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
210 RenderWidgetHostImpl* GetRenderWidgetHost(); | 239 RenderWidgetHostImpl* GetRenderWidgetHost(); |
211 | 240 |
212 // This returns the RenderWidgetHostView that can be used to control | 241 // This returns the RenderWidgetHostView that can be used to control |
213 // focus and visibility for this frame. | 242 // focus and visibility for this frame. |
214 RenderWidgetHostView* GetView(); | 243 RenderWidgetHostView* GetView(); |
215 | 244 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 bool is_waiting_for_beforeunload_ack_; | 686 bool is_waiting_for_beforeunload_ack_; |
658 | 687 |
659 // Valid only when is_waiting_for_beforeunload_ack_ or | 688 // Valid only when is_waiting_for_beforeunload_ack_ or |
660 // IsWaitingForUnloadACK is true. This tells us if the unload request | 689 // IsWaitingForUnloadACK is true. This tells us if the unload request |
661 // is for closing the entire tab ( = false), or only this RenderFrameHost in | 690 // is for closing the entire tab ( = false), or only this RenderFrameHost in |
662 // the case of a navigation ( = true). Currently only cross-site navigations | 691 // the case of a navigation ( = true). Currently only cross-site navigations |
663 // require a beforeUnload/unload ACK. | 692 // require a beforeUnload/unload ACK. |
664 // PlzNavigate: all navigations require a beforeUnload ACK. | 693 // PlzNavigate: all navigations require a beforeUnload ACK. |
665 bool unload_ack_is_for_navigation_; | 694 bool unload_ack_is_for_navigation_; |
666 | 695 |
| 696 // Indicates whether this RenderFrameHost is in the process of loading a |
| 697 // document or not. |
| 698 bool is_loading_; |
| 699 |
| 700 // Used to track this RenderFrameHost's loading progress (from 0 to 1). |
| 701 double loading_progress_; |
| 702 |
667 // Used to swap out or shut down this RFH when the unload event is taking too | 703 // Used to swap out or shut down this RFH when the unload event is taking too |
668 // long to execute, depending on the number of active frames in the | 704 // long to execute, depending on the number of active frames in the |
669 // SiteInstance. | 705 // SiteInstance. |
670 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; | 706 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; |
671 | 707 |
672 scoped_ptr<ServiceRegistryImpl> service_registry_; | 708 scoped_ptr<ServiceRegistryImpl> service_registry_; |
673 | 709 |
674 #if defined(OS_ANDROID) | 710 #if defined(OS_ANDROID) |
675 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; | 711 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; |
676 #endif | 712 #endif |
(...skipping 27 matching lines...) Expand all Loading... |
704 | 740 |
705 // NOTE: This must be the last member. | 741 // NOTE: This must be the last member. |
706 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 742 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
707 | 743 |
708 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 744 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
709 }; | 745 }; |
710 | 746 |
711 } // namespace content | 747 } // namespace content |
712 | 748 |
713 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 749 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |