| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 cross_process_frame_connector_(NULL), | 144 cross_process_frame_connector_(NULL), |
| 145 render_frame_proxy_host_(NULL), | 145 render_frame_proxy_host_(NULL), |
| 146 frame_tree_(frame_tree), | 146 frame_tree_(frame_tree), |
| 147 frame_tree_node_(frame_tree_node), | 147 frame_tree_node_(frame_tree_node), |
| 148 routing_id_(routing_id), | 148 routing_id_(routing_id), |
| 149 render_frame_created_(false), | 149 render_frame_created_(false), |
| 150 navigations_suspended_(false), | 150 navigations_suspended_(false), |
| 151 is_waiting_for_beforeunload_ack_(false), | 151 is_waiting_for_beforeunload_ack_(false), |
| 152 unload_ack_is_for_navigation_(false), | 152 unload_ack_is_for_navigation_(false), |
| 153 is_loading_(false), | 153 is_loading_(false), |
| 154 pending_commit_(false), |
| 154 accessibility_reset_token_(0), | 155 accessibility_reset_token_(0), |
| 155 accessibility_reset_count_(0), | 156 accessibility_reset_count_(0), |
| 156 no_create_browser_accessibility_manager_for_testing_(false), | 157 no_create_browser_accessibility_manager_for_testing_(false), |
| 157 weak_ptr_factory_(this) { | 158 weak_ptr_factory_(this) { |
| 158 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); | 159 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); |
| 159 bool hidden = !!(flags & CREATE_RF_HIDDEN); | 160 bool hidden = !!(flags & CREATE_RF_HIDDEN); |
| 160 frame_tree_->RegisterRenderFrameHost(this); | 161 frame_tree_->RegisterRenderFrameHost(this); |
| 161 GetProcess()->AddRoute(routing_id_, this); | 162 GetProcess()->AddRoute(routing_id_, this); |
| 162 g_routing_id_frame_map.Get().insert(std::make_pair( | 163 g_routing_id_frame_map.Get().insert(std::make_pair( |
| 163 RenderFrameHostID(GetProcess()->GetID(), routing_id_), | 164 RenderFrameHostID(GetProcess()->GetID(), routing_id_), |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 // filenames it can't access in a future session restore. | 842 // filenames it can't access in a future session restore. |
| 842 if (!render_view_host_->CanAccessFilesOfPageState( | 843 if (!render_view_host_->CanAccessFilesOfPageState( |
| 843 validated_params.page_state)) { | 844 validated_params.page_state)) { |
| 844 bad_message::ReceivedBadMessage( | 845 bad_message::ReceivedBadMessage( |
| 845 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); | 846 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); |
| 846 return; | 847 return; |
| 847 } | 848 } |
| 848 | 849 |
| 849 accessibility_reset_count_ = 0; | 850 accessibility_reset_count_ = 0; |
| 850 frame_tree_node()->navigator()->DidNavigate(this, validated_params); | 851 frame_tree_node()->navigator()->DidNavigate(this, validated_params); |
| 852 |
| 853 // PlzNavigate |
| 854 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 855 switches::kEnableBrowserSideNavigation)) { |
| 856 pending_commit_ = false; |
| 857 } |
| 851 } | 858 } |
| 852 | 859 |
| 853 void RenderFrameHostImpl::OnDidDropNavigation() { | 860 void RenderFrameHostImpl::OnDidDropNavigation() { |
| 854 // At the end of Navigate(), the FrameTreeNode's DidStartLoading is called to | 861 // At the end of Navigate(), the FrameTreeNode's DidStartLoading is called to |
| 855 // force the spinner to start, even if the renderer didn't yet begin the load. | 862 // force the spinner to start, even if the renderer didn't yet begin the load. |
| 856 // If it turns out that the renderer dropped the navigation, the spinner needs | 863 // If it turns out that the renderer dropped the navigation, the spinner needs |
| 857 // to be turned off. | 864 // to be turned off. |
| 858 frame_tree_node_->DidStopLoading(); | 865 frame_tree_node_->DidStopLoading(); |
| 859 } | 866 } |
| 860 | 867 |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 const ResourceResponseHead head = response ? | 1784 const ResourceResponseHead head = response ? |
| 1778 response->head : ResourceResponseHead(); | 1785 response->head : ResourceResponseHead(); |
| 1779 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 1786 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
| 1780 request_params)); | 1787 request_params)); |
| 1781 // TODO(clamy): Check if we should start the throbber for non javascript urls | 1788 // TODO(clamy): Check if we should start the throbber for non javascript urls |
| 1782 // here. | 1789 // here. |
| 1783 | 1790 |
| 1784 // TODO(clamy): Release the stream handle once the renderer has finished | 1791 // TODO(clamy): Release the stream handle once the renderer has finished |
| 1785 // reading it. | 1792 // reading it. |
| 1786 stream_handle_ = body.Pass(); | 1793 stream_handle_ = body.Pass(); |
| 1794 pending_commit_ = true; |
| 1787 } | 1795 } |
| 1788 | 1796 |
| 1789 void RenderFrameHostImpl::FailedNavigation( | 1797 void RenderFrameHostImpl::FailedNavigation( |
| 1790 const CommonNavigationParams& common_params, | 1798 const CommonNavigationParams& common_params, |
| 1791 const RequestNavigationParams& request_params, | 1799 const RequestNavigationParams& request_params, |
| 1792 bool has_stale_copy_in_cache, | 1800 bool has_stale_copy_in_cache, |
| 1793 int error_code) { | 1801 int error_code) { |
| 1794 // Get back to a clean state, in case a new navigation started without | 1802 // Get back to a clean state, in case a new navigation started without |
| 1795 // completing a RFH swap or unload handler. | 1803 // completing a RFH swap or unload handler. |
| 1796 SetState(RenderFrameHostImpl::STATE_DEFAULT); | 1804 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 return; | 2054 return; |
| 2047 | 2055 |
| 2048 permission_manager->RegisterPermissionUsage( | 2056 permission_manager->RegisterPermissionUsage( |
| 2049 PermissionType::GEOLOCATION, | 2057 PermissionType::GEOLOCATION, |
| 2050 GetLastCommittedURL().GetOrigin(), | 2058 GetLastCommittedURL().GetOrigin(), |
| 2051 frame_tree_node()->frame_tree()->GetMainFrame() | 2059 frame_tree_node()->frame_tree()->GetMainFrame() |
| 2052 ->GetLastCommittedURL().GetOrigin()); | 2060 ->GetLastCommittedURL().GetOrigin()); |
| 2053 } | 2061 } |
| 2054 | 2062 |
| 2055 } // namespace content | 2063 } // namespace content |
| OLD | NEW |