| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // is for closing the entire tab ( = false), or only this RenderFrameHost in | 647 // is for closing the entire tab ( = false), or only this RenderFrameHost in |
| 667 // the case of a navigation ( = true). Currently only cross-site navigations | 648 // the case of a navigation ( = true). Currently only cross-site navigations |
| 668 // require a beforeUnload/unload ACK. | 649 // require a beforeUnload/unload ACK. |
| 669 // PlzNavigate: all navigations require a beforeUnload ACK. | 650 // PlzNavigate: all navigations require a beforeUnload ACK. |
| 670 bool unload_ack_is_for_navigation_; | 651 bool unload_ack_is_for_navigation_; |
| 671 | 652 |
| 672 // Indicates whether this RenderFrameHost is in the process of loading a | 653 // Indicates whether this RenderFrameHost is in the process of loading a |
| 673 // document or not. | 654 // document or not. |
| 674 bool is_loading_; | 655 bool is_loading_; |
| 675 | 656 |
| 676 // Used to track this RenderFrameHost's loading progress (from 0 to 1). | |
| 677 double loading_progress_; | |
| 678 | |
| 679 // Used to swap out or shut down this RFH when the unload event is taking too | 657 // Used to swap out or shut down this RFH when the unload event is taking too |
| 680 // long to execute, depending on the number of active frames in the | 658 // long to execute, depending on the number of active frames in the |
| 681 // SiteInstance. | 659 // SiteInstance. |
| 682 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; | 660 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; |
| 683 | 661 |
| 684 scoped_ptr<ServiceRegistryImpl> service_registry_; | 662 scoped_ptr<ServiceRegistryImpl> service_registry_; |
| 685 | 663 |
| 686 #if defined(OS_ANDROID) | 664 #if defined(OS_ANDROID) |
| 687 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; | 665 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; |
| 688 #endif | 666 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 716 | 694 |
| 717 // NOTE: This must be the last member. | 695 // NOTE: This must be the last member. |
| 718 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 696 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 719 | 697 |
| 720 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 698 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 721 }; | 699 }; |
| 722 | 700 |
| 723 } // namespace content | 701 } // namespace content |
| 724 | 702 |
| 725 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 703 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |