Chromium Code Reviews| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/browser/accessibility/browser_accessibility_manager.h" | 17 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 18 #include "content/browser/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
| 19 #include "content/common/accessibility_mode_enums.h" | 19 #include "content/common/accessibility_mode_enums.h" |
| 20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 21 #include "content/common/frame_message_enums.h" | 21 #include "content/common/frame_message_enums.h" |
| 22 #include "content/common/frame_replication_state.h" | 22 #include "content/common/frame_replication_state.h" |
| 23 #include "content/common/mojo/service_registry_impl.h" | 23 #include "content/common/mojo/service_registry_impl.h" |
| 24 #include "content/common/navigation_params.h" | |
| 24 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
| 25 #include "content/public/common/javascript_message_type.h" | 26 #include "content/public/common/javascript_message_type.h" |
| 26 #include "net/http/http_response_headers.h" | 27 #include "net/http/http_response_headers.h" |
| 27 #include "third_party/WebKit/public/web/WebTextDirection.h" | 28 #include "third_party/WebKit/public/web/WebTextDirection.h" |
| 28 #include "ui/accessibility/ax_node_data.h" | 29 #include "ui/accessibility/ax_node_data.h" |
| 29 #include "ui/base/page_transition_types.h" | 30 #include "ui/base/page_transition_types.h" |
| 30 | 31 |
| 31 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 32 #include "content/browser/mojo/service_registry_android.h" | 33 #include "content/browser/mojo/service_registry_android.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 class GURL; | 36 class GURL; |
| 36 struct AccessibilityHostMsg_EventParams; | 37 struct AccessibilityHostMsg_EventParams; |
| 37 struct AccessibilityHostMsg_FindInPageResultParams; | 38 struct AccessibilityHostMsg_FindInPageResultParams; |
| 38 struct AccessibilityHostMsg_LocationChangeParams; | 39 struct AccessibilityHostMsg_LocationChangeParams; |
| 39 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; | 40 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; |
| 40 struct FrameHostMsg_OpenURL_Params; | 41 struct FrameHostMsg_OpenURL_Params; |
| 41 struct FrameHostMsg_BeginNavigation_Params; | |
| 42 struct FrameMsg_Navigate_Params; | |
| 43 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 42 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 44 struct FrameHostMsg_ShowPopup_Params; | 43 struct FrameHostMsg_ShowPopup_Params; |
| 45 #endif | 44 #endif |
| 46 | 45 |
| 47 namespace base { | 46 namespace base { |
| 48 class FilePath; | 47 class FilePath; |
| 49 class ListValue; | 48 class ListValue; |
| 50 } | 49 } |
| 51 | 50 |
| 52 namespace content { | 51 namespace content { |
| 53 | 52 |
| 54 class CrossProcessFrameConnector; | 53 class CrossProcessFrameConnector; |
| 55 class CrossSiteTransferringRequest; | 54 class CrossSiteTransferringRequest; |
| 56 class FrameTree; | 55 class FrameTree; |
| 57 class FrameTreeNode; | 56 class FrameTreeNode; |
| 58 class PermissionServiceContext; | 57 class PermissionServiceContext; |
| 59 class RenderFrameHostDelegate; | 58 class RenderFrameHostDelegate; |
| 60 class RenderFrameProxyHost; | 59 class RenderFrameProxyHost; |
| 61 class RenderProcessHost; | 60 class RenderProcessHost; |
| 62 class RenderViewHostImpl; | 61 class RenderViewHostImpl; |
| 63 class RenderWidgetHostDelegate; | 62 class RenderWidgetHostDelegate; |
| 64 class RenderWidgetHostImpl; | 63 class RenderWidgetHostImpl; |
| 65 class RenderWidgetHostView; | 64 class RenderWidgetHostView; |
| 66 class ResourceRequestBody; | 65 class ResourceRequestBody; |
| 67 class StreamHandle; | 66 class StreamHandle; |
| 68 class TimeoutMonitor; | 67 class TimeoutMonitor; |
| 69 struct BeginNavigationParams; | |
| 70 struct CommitNavigationParams; | |
| 71 struct CommonNavigationParams; | |
| 72 struct ContextMenuParams; | 68 struct ContextMenuParams; |
| 73 struct GlobalRequestID; | 69 struct GlobalRequestID; |
| 74 struct HistoryNavigationParams; | |
| 75 struct Referrer; | 70 struct Referrer; |
| 76 struct ResourceResponse; | 71 struct ResourceResponse; |
| 77 struct TransitionLayerData; | 72 struct TransitionLayerData; |
| 78 | 73 |
| 79 // Flag arguments for RenderFrameHost creation. | 74 // Flag arguments for RenderFrameHost creation. |
| 80 enum CreateRenderFrameFlags { | 75 enum CreateRenderFrameFlags { |
| 81 // The RFH will be initially placed on the swapped out hosts list. | 76 // The RFH will be initially placed on the swapped out hosts list. |
| 82 CREATE_RF_SWAPPED_OUT = 1 << 0, | 77 CREATE_RF_SWAPPED_OUT = 1 << 0, |
| 83 // The new RenderFrame is being created for a navigation of the | 78 // The new RenderFrame is being created for a navigation of the |
| 84 // top-level frame. | 79 // top-level frame. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 // The current state of this RFH. | 289 // The current state of this RFH. |
| 295 RenderFrameHostImplState rfh_state() const { return rfh_state_; } | 290 RenderFrameHostImplState rfh_state() const { return rfh_state_; } |
| 296 | 291 |
| 297 // Sends the given navigation message. Use this rather than sending it | 292 // Sends the given navigation message. Use this rather than sending it |
| 298 // yourself since this does the internal bookkeeping described below. This | 293 // yourself since this does the internal bookkeeping described below. This |
| 299 // function takes ownership of the provided message pointer. | 294 // function takes ownership of the provided message pointer. |
| 300 // | 295 // |
| 301 // If a cross-site request is in progress, we may be suspended while waiting | 296 // If a cross-site request is in progress, we may be suspended while waiting |
| 302 // for the onbeforeunload handler, so this function might buffer the message | 297 // for the onbeforeunload handler, so this function might buffer the message |
| 303 // rather than sending it. | 298 // rather than sending it. |
| 304 void Navigate(const FrameMsg_Navigate_Params& params); | 299 void Navigate(const CommonNavigationParams& common_params, |
| 300 const StartNavigationParams& start_params, | |
| 301 const CommitNavigationParams& commit_params, | |
| 302 const HistoryNavigationParams& history_params); | |
| 305 | 303 |
| 306 // Load the specified URL; this is a shortcut for Navigate(). | 304 // Load the specified URL; this is a shortcut for Navigate(). |
| 307 void NavigateToURL(const GURL& url); | 305 void NavigateToURL(const GURL& url); |
| 308 | 306 |
| 309 // Treat this prospective navigation as though it originated from the frame. | 307 // Treat this prospective navigation as though it originated from the frame. |
| 310 // Used, e.g., for a navigation request that originated from a RemoteFrame. | 308 // Used, e.g., for a navigation request that originated from a RemoteFrame. |
| 311 // |source_site_instance| is the SiteInstance of the frame that initiated the | 309 // |source_site_instance| is the SiteInstance of the frame that initiated the |
| 312 // navigation. | 310 // navigation. |
| 313 // TODO(creis): Remove this method and have RenderFrameProxyHost call | 311 // TODO(creis): Remove this method and have RenderFrameProxyHost call |
| 314 // RequestOpenURL with its FrameTreeNode. | 312 // RequestOpenURL with its FrameTreeNode. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 // the renderer process. Currently only used for subframes. | 620 // the renderer process. Currently only used for subframes. |
| 623 // TODO(creis): Use this for main frames as well when RVH goes away. | 621 // TODO(creis): Use this for main frames as well when RVH goes away. |
| 624 bool render_frame_created_; | 622 bool render_frame_created_; |
| 625 | 623 |
| 626 // Whether we should buffer outgoing Navigate messages rather than sending | 624 // Whether we should buffer outgoing Navigate messages rather than sending |
| 627 // them. This will be true when a RenderFrameHost is created for a cross-site | 625 // them. This will be true when a RenderFrameHost is created for a cross-site |
| 628 // request, until we hear back from the onbeforeunload handler of the old | 626 // request, until we hear back from the onbeforeunload handler of the old |
| 629 // RenderFrameHost. | 627 // RenderFrameHost. |
| 630 bool navigations_suspended_; | 628 bool navigations_suspended_; |
| 631 | 629 |
| 632 // We only buffer the params for a suspended navigation while this RFH is the | 630 // Holds the parameters for a suspended navigation. This can only happen while |
| 633 // pending RenderFrameHost of a RenderFrameHostManager. There will only ever | 631 // this RFH is the pending RenderFrameHost of a RenderFrameHostManager. There |
| 634 // be one suspended navigation, because RenderFrameHostManager will destroy | 632 // will only ever be one suspended navigation, because RenderFrameHostManager |
| 635 // the pending RenderFrameHost and create a new one if a second navigation | 633 // will destroy the pending RenderFrameHost and create a new one if a second |
| 636 // occurs. | 634 // navigation occurs. |
| 637 scoped_ptr<FrameMsg_Navigate_Params> suspended_nav_params_; | 635 // PlzNavigate: unused as navigations are never suspended. |
| 636 struct NavigateParams { | |
|
nasko
2015/03/09 23:24:23
Let's name this so that it is obvious it is used o
clamy
2015/03/10 16:45:44
I've moved it to navigation_params.h to reuse in R
| |
| 637 NavigateParams(const CommonNavigationParams& common_params, | |
| 638 const StartNavigationParams& start_params, | |
| 639 const CommitNavigationParams& commit_params, | |
| 640 const HistoryNavigationParams& history_params); | |
| 641 ~NavigateParams(); | |
| 642 | |
| 643 const CommonNavigationParams common_params; | |
| 644 const StartNavigationParams start_params; | |
| 645 // The navigation start timestamp in |commit_params| is updated with the | |
| 646 // time at which BeforeUnload completed. | |
| 647 CommitNavigationParams commit_params; | |
| 648 const HistoryNavigationParams history_params; | |
| 649 }; | |
| 650 scoped_ptr<NavigateParams> suspended_nav_params_; | |
| 638 | 651 |
| 639 // When the last BeforeUnload message was sent. | 652 // When the last BeforeUnload message was sent. |
| 640 base::TimeTicks send_before_unload_start_time_; | 653 base::TimeTicks send_before_unload_start_time_; |
| 641 | 654 |
| 642 // Used to track whether sudden termination is allowed for this frame. | 655 // Used to track whether sudden termination is allowed for this frame. |
| 643 // has_beforeunload_handlers_ and has_unload_handlers_ are also used to avoid | 656 // has_beforeunload_handlers_ and has_unload_handlers_ are also used to avoid |
| 644 // asking the renderer process to run BeforeUnload or Unload during | 657 // asking the renderer process to run BeforeUnload or Unload during |
| 645 // navigation. The browser can set override_sudden_termination_status_ to | 658 // navigation. The browser can set override_sudden_termination_status_ to |
| 646 // true, in which case sudden termination will be allowed. This is used when a | 659 // true, in which case sudden termination will be allowed. This is used when a |
| 647 // renderer executing BeforeUnload or Unload is unresponsive. All other values | 660 // renderer executing BeforeUnload or Unload is unresponsive. All other values |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 | 720 |
| 708 // NOTE: This must be the last member. | 721 // NOTE: This must be the last member. |
| 709 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 722 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 710 | 723 |
| 711 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 724 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 712 }; | 725 }; |
| 713 | 726 |
| 714 } // namespace content | 727 } // namespace content |
| 715 | 728 |
| 716 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 729 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |