| 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 #include "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "content/browser/permissions/permission_service_impl.h" | 32 #include "content/browser/permissions/permission_service_impl.h" |
| 33 #include "content/browser/presentation/presentation_service_impl.h" | 33 #include "content/browser/presentation/presentation_service_impl.h" |
| 34 #include "content/browser/renderer_host/input/input_router.h" | 34 #include "content/browser/renderer_host/input/input_router.h" |
| 35 #include "content/browser/renderer_host/input/timeout_monitor.h" | 35 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 36 #include "content/browser/renderer_host/render_process_host_impl.h" | 36 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 37 #include "content/browser/renderer_host/render_view_host_delegate.h" | 37 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 38 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 39 #include "content/browser/renderer_host/render_view_host_impl.h" | 39 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 40 #include "content/browser/renderer_host/render_widget_host_impl.h" | 40 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 41 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 41 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 42 #include "content/browser/transition_request_manager.h" | |
| 43 #include "content/common/accessibility_messages.h" | 42 #include "content/common/accessibility_messages.h" |
| 44 #include "content/common/frame_messages.h" | 43 #include "content/common/frame_messages.h" |
| 45 #include "content/common/input_messages.h" | 44 #include "content/common/input_messages.h" |
| 46 #include "content/common/inter_process_time_ticks_converter.h" | 45 #include "content/common/inter_process_time_ticks_converter.h" |
| 47 #include "content/common/navigation_params.h" | 46 #include "content/common/navigation_params.h" |
| 48 #include "content/common/render_frame_setup.mojom.h" | 47 #include "content/common/render_frame_setup.mojom.h" |
| 49 #include "content/common/swapped_out_messages.h" | 48 #include "content/common/swapped_out_messages.h" |
| 50 #include "content/public/browser/ax_event_notification_details.h" | 49 #include "content/public/browser/ax_event_notification_details.h" |
| 51 #include "content/public/browser/browser_accessibility_state.h" | 50 #include "content/public/browser/browser_accessibility_state.h" |
| 52 #include "content/public/browser/browser_context.h" | 51 #include "content/public/browser/browser_context.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Intent", | 750 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Intent", |
| 752 base::TimeTicks::Now() - ui_timestamp, | 751 base::TimeTicks::Now() - ui_timestamp, |
| 753 base::TimeDelta::FromMilliseconds(10), | 752 base::TimeDelta::FromMilliseconds(10), |
| 754 base::TimeDelta::FromMinutes(10), 100); | 753 base::TimeDelta::FromMinutes(10), 100); |
| 755 } | 754 } |
| 756 // This message is only sent for top-level frames. TODO(avi): when frame tree | 755 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 757 // mirroring works correctly, add a check here to enforce it. | 756 // mirroring works correctly, add a check here to enforce it. |
| 758 delegate_->DocumentOnLoadCompleted(this); | 757 delegate_->DocumentOnLoadCompleted(this); |
| 759 } | 758 } |
| 760 | 759 |
| 761 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( | 760 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame(const GURL& url) { |
| 762 const GURL& url, | |
| 763 bool is_transition_navigation) { | |
| 764 frame_tree_node_->navigator()->DidStartProvisionalLoad( | 761 frame_tree_node_->navigator()->DidStartProvisionalLoad( |
| 765 this, url, is_transition_navigation); | 762 this, url); |
| 766 } | 763 } |
| 767 | 764 |
| 768 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( | 765 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( |
| 769 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 766 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 770 frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); | 767 frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); |
| 771 } | 768 } |
| 772 | 769 |
| 773 void RenderFrameHostImpl::OnDidFailLoadWithError( | 770 void RenderFrameHostImpl::OnDidFailLoadWithError( |
| 774 const GURL& url, | 771 const GURL& url, |
| 775 int error_code, | 772 int error_code, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 const std::vector<GURL>& transfer_url_chain, | 924 const std::vector<GURL>& transfer_url_chain, |
| 928 const Referrer& referrer, | 925 const Referrer& referrer, |
| 929 ui::PageTransition page_transition, | 926 ui::PageTransition page_transition, |
| 930 bool should_replace_current_entry) { | 927 bool should_replace_current_entry) { |
| 931 frame_tree_node_->render_manager()->OnCrossSiteResponse( | 928 frame_tree_node_->render_manager()->OnCrossSiteResponse( |
| 932 this, global_request_id, cross_site_transferring_request.Pass(), | 929 this, global_request_id, cross_site_transferring_request.Pass(), |
| 933 transfer_url_chain, referrer, page_transition, | 930 transfer_url_chain, referrer, page_transition, |
| 934 should_replace_current_entry); | 931 should_replace_current_entry); |
| 935 } | 932 } |
| 936 | 933 |
| 937 void RenderFrameHostImpl::OnDeferredAfterResponseStarted( | |
| 938 const GlobalRequestID& global_request_id, | |
| 939 const TransitionLayerData& transition_data) { | |
| 940 frame_tree_node_->render_manager()->OnDeferredAfterResponseStarted( | |
| 941 global_request_id, this); | |
| 942 | |
| 943 if (GetParent() || !delegate_->WillHandleDeferAfterResponseStarted()) | |
| 944 frame_tree_node_->render_manager()->ResumeResponseDeferredAtStart(); | |
| 945 else | |
| 946 delegate_->DidDeferAfterResponseStarted(transition_data); | |
| 947 } | |
| 948 | |
| 949 void RenderFrameHostImpl::SwapOut( | 934 void RenderFrameHostImpl::SwapOut( |
| 950 RenderFrameProxyHost* proxy, | 935 RenderFrameProxyHost* proxy, |
| 951 bool is_loading) { | 936 bool is_loading) { |
| 952 // The end of this event is in OnSwapOutACK when the RenderFrame has completed | 937 // The end of this event is in OnSwapOutACK when the RenderFrame has completed |
| 953 // the operation and sends back an IPC message. | 938 // the operation and sends back an IPC message. |
| 954 // The trace event may not end properly if the ACK times out. We expect this | 939 // The trace event may not end properly if the ACK times out. We expect this |
| 955 // to be fixed when RenderViewHostImpl::OnSwapOut moves to RenderFrameHost. | 940 // to be fixed when RenderViewHostImpl::OnSwapOut moves to RenderFrameHost. |
| 956 TRACE_EVENT_ASYNC_BEGIN0("navigation", "RenderFrameHostImpl::SwapOut", this); | 941 TRACE_EVENT_ASYNC_BEGIN0("navigation", "RenderFrameHostImpl::SwapOut", this); |
| 957 | 942 |
| 958 // If this RenderFrameHost is not in the default state, it must have already | 943 // If this RenderFrameHost is not in the default state, it must have already |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 Send(new FrameMsg_SelectPopupMenuItems(routing_id_, false, selected_indices)); | 1985 Send(new FrameMsg_SelectPopupMenuItems(routing_id_, false, selected_indices)); |
| 2001 } | 1986 } |
| 2002 | 1987 |
| 2003 void RenderFrameHostImpl::DidCancelPopupMenu() { | 1988 void RenderFrameHostImpl::DidCancelPopupMenu() { |
| 2004 Send(new FrameMsg_SelectPopupMenuItems( | 1989 Send(new FrameMsg_SelectPopupMenuItems( |
| 2005 routing_id_, true, std::vector<int>())); | 1990 routing_id_, true, std::vector<int>())); |
| 2006 } | 1991 } |
| 2007 | 1992 |
| 2008 #endif | 1993 #endif |
| 2009 | 1994 |
| 2010 void RenderFrameHostImpl::ClearPendingTransitionRequestData() { | |
| 2011 BrowserThread::PostTask( | |
| 2012 BrowserThread::IO, | |
| 2013 FROM_HERE, | |
| 2014 base::Bind( | |
| 2015 &TransitionRequestManager::ClearPendingTransitionRequestData, | |
| 2016 base::Unretained(TransitionRequestManager::GetInstance()), | |
| 2017 GetProcess()->GetID(), | |
| 2018 routing_id_)); | |
| 2019 } | |
| 2020 | |
| 2021 void RenderFrameHostImpl::SetNavigationsSuspended( | 1995 void RenderFrameHostImpl::SetNavigationsSuspended( |
| 2022 bool suspend, | 1996 bool suspend, |
| 2023 const base::TimeTicks& proceed_time) { | 1997 const base::TimeTicks& proceed_time) { |
| 2024 // This should only be called to toggle the state. | 1998 // This should only be called to toggle the state. |
| 2025 DCHECK(navigations_suspended_ != suspend); | 1999 DCHECK(navigations_suspended_ != suspend); |
| 2026 | 2000 |
| 2027 navigations_suspended_ = suspend; | 2001 navigations_suspended_ = suspend; |
| 2028 if (navigations_suspended_) { | 2002 if (navigations_suspended_) { |
| 2029 TRACE_EVENT_ASYNC_BEGIN0("navigation", | 2003 TRACE_EVENT_ASYNC_BEGIN0("navigation", |
| 2030 "RenderFrameHostImpl navigation suspended", this); | 2004 "RenderFrameHostImpl navigation suspended", this); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2093 // We may be returning to an existing NavigationEntry that had been granted | 2067 // We may be returning to an existing NavigationEntry that had been granted |
| 2094 // file access. If this is a different process, we will need to grant the | 2068 // file access. If this is a different process, we will need to grant the |
| 2095 // access again. The files listed in the page state are validated when they | 2069 // access again. The files listed in the page state are validated when they |
| 2096 // are received from the renderer to prevent abuse. | 2070 // are received from the renderer to prevent abuse. |
| 2097 if (request_params.page_state.IsValid()) { | 2071 if (request_params.page_state.IsValid()) { |
| 2098 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); | 2072 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); |
| 2099 } | 2073 } |
| 2100 } | 2074 } |
| 2101 | 2075 |
| 2102 } // namespace content | 2076 } // namespace content |
| OLD | NEW |