| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // The RenderFrameHost will have a new RenderWidgetHost created and | 83 // The RenderFrameHost will have a new RenderWidgetHost created and |
| 84 // attached to it. This is used when the RenderFrameHost is in a different | 84 // attached to it. This is used when the RenderFrameHost is in a different |
| 85 // process from its parent frame. | 85 // process from its parent frame. |
| 86 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 | 86 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class CONTENT_EXPORT RenderFrameHostImpl | 89 class CONTENT_EXPORT RenderFrameHostImpl |
| 90 : public RenderFrameHost, | 90 : public RenderFrameHost, |
| 91 public BrowserAccessibilityDelegate { | 91 public BrowserAccessibilityDelegate { |
| 92 public: | 92 public: |
| 93 // These values indicate the loading progress status. The minimum progress | |
| 94 // value matches what Blink's ProgressTracker has traditionally used for a | |
| 95 // minimum progress value. | |
| 96 // TODO(fdegans): Move these values to the implementation when the relevant | |
| 97 // IPCs are moved from WebContentsImpl to RenderFrameHost. | |
| 98 static const double kLoadingProgressNotStarted; | |
| 99 static const double kLoadingProgressMinimum; | |
| 100 static const double kLoadingProgressDone; | |
| 101 | |
| 102 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 93 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
| 103 // respect to swap out. | 94 // respect to swap out. |
| 104 enum RenderFrameHostImplState { | 95 enum RenderFrameHostImplState { |
| 105 // The standard state for a RFH handling the communication with an active | 96 // The standard state for a RFH handling the communication with an active |
| 106 // RenderFrame. | 97 // RenderFrame. |
| 107 STATE_DEFAULT = 0, | 98 STATE_DEFAULT = 0, |
| 108 // The RFH has not received the SwapOutACK yet, but the new page has | 99 // The RFH has not received the SwapOutACK yet, but the new page has |
| 109 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH | 100 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH |
| 110 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are | 101 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are |
| 111 // other active frames in its SiteInstance) or it will be deleted. | 102 // other active frames in its SiteInstance) or it will be deleted. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Sets this RenderFrameHost's loading state. | 202 // Sets this RenderFrameHost's loading state. |
| 212 void set_is_loading(bool is_loading) { | 203 void set_is_loading(bool is_loading) { |
| 213 is_loading_ = is_loading; | 204 is_loading_ = is_loading; |
| 214 } | 205 } |
| 215 | 206 |
| 216 // Returns this RenderFrameHost's loading state. This method is only used by | 207 // Returns this RenderFrameHost's loading state. This method is only used by |
| 217 // FrameTreeNode. The proper way to check whether a frame is loading is to | 208 // FrameTreeNode. The proper way to check whether a frame is loading is to |
| 218 // call FrameTreeNode::IsLoading. | 209 // call FrameTreeNode::IsLoading. |
| 219 bool is_loading() const { return is_loading_; } | 210 bool is_loading() const { return is_loading_; } |
| 220 | 211 |
| 221 // Sets this RenderFrameHost's loading progress (from 0 to 1). | |
| 222 void set_loading_progress(double loading_progress) { | |
| 223 loading_progress_ = loading_progress; | |
| 224 } | |
| 225 | |
| 226 // Returns this RenderFrameHost's loading progress. This is only used by | |
| 227 // FrameTreeNode. The proper way to check a frame loading progress is to call | |
| 228 // FrameTreeNode::GetLoadingProgress. | |
| 229 double loading_progress() const { return loading_progress_; } | |
| 230 | |
| 231 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 212 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
| 232 // or else it returns nullptr. | 213 // or else it returns nullptr. |
| 233 // If the RenderFrameHost is the page's main frame, this returns instead a | 214 // If the RenderFrameHost is the page's main frame, this returns instead a |
| 234 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 215 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
| 235 RenderWidgetHostImpl* GetRenderWidgetHost(); | 216 RenderWidgetHostImpl* GetRenderWidgetHost(); |
| 236 | 217 |
| 237 // This returns the RenderWidgetHostView that can be used to control | 218 // This returns the RenderWidgetHostView that can be used to control |
| 238 // focus and visibility for this frame. | 219 // focus and visibility for this frame. |
| 239 RenderWidgetHostView* GetView(); | 220 RenderWidgetHostView* GetView(); |
| 240 | 221 |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 // is for closing the entire tab ( = false), or only this RenderFrameHost in | 674 // is for closing the entire tab ( = false), or only this RenderFrameHost in |
| 694 // the case of a navigation ( = true). Currently only cross-site navigations | 675 // the case of a navigation ( = true). Currently only cross-site navigations |
| 695 // require a beforeUnload/unload ACK. | 676 // require a beforeUnload/unload ACK. |
| 696 // PlzNavigate: all navigations require a beforeUnload ACK. | 677 // PlzNavigate: all navigations require a beforeUnload ACK. |
| 697 bool unload_ack_is_for_navigation_; | 678 bool unload_ack_is_for_navigation_; |
| 698 | 679 |
| 699 // Indicates whether this RenderFrameHost is in the process of loading a | 680 // Indicates whether this RenderFrameHost is in the process of loading a |
| 700 // document or not. | 681 // document or not. |
| 701 bool is_loading_; | 682 bool is_loading_; |
| 702 | 683 |
| 703 // Used to track this RenderFrameHost's loading progress (from 0 to 1). | |
| 704 double loading_progress_; | |
| 705 | |
| 706 // Used to swap out or shut down this RFH when the unload event is taking too | 684 // Used to swap out or shut down this RFH when the unload event is taking too |
| 707 // long to execute, depending on the number of active frames in the | 685 // long to execute, depending on the number of active frames in the |
| 708 // SiteInstance. | 686 // SiteInstance. |
| 709 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; | 687 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; |
| 710 | 688 |
| 711 scoped_ptr<ServiceRegistryImpl> service_registry_; | 689 scoped_ptr<ServiceRegistryImpl> service_registry_; |
| 712 | 690 |
| 713 #if defined(OS_ANDROID) | 691 #if defined(OS_ANDROID) |
| 714 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; | 692 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; |
| 715 #endif | 693 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 743 | 721 |
| 744 // NOTE: This must be the last member. | 722 // NOTE: This must be the last member. |
| 745 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 723 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 746 | 724 |
| 747 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 725 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 748 }; | 726 }; |
| 749 | 727 |
| 750 } // namespace content | 728 } // namespace content |
| 751 | 729 |
| 752 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 730 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |