| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 9 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 11 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
| 12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 14 #include "content/browser/accessibility/accessibility_mode_helper.h" | 16 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| 15 #include "content/browser/accessibility/ax_tree_id_registry.h" | 17 #include "content/browser/accessibility/ax_tree_id_registry.h" |
| 16 #include "content/browser/accessibility/browser_accessibility_manager.h" | 18 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 NOTREACHED(); | 1062 NOTREACHED(); |
| 1061 return nullptr; | 1063 return nullptr; |
| 1062 } | 1064 } |
| 1063 | 1065 |
| 1064 int RenderFrameHostImpl::GetEnabledBindings() { | 1066 int RenderFrameHostImpl::GetEnabledBindings() { |
| 1065 return render_view_host_->GetEnabledBindings(); | 1067 return render_view_host_->GetEnabledBindings(); |
| 1066 } | 1068 } |
| 1067 | 1069 |
| 1068 void RenderFrameHostImpl::SetNavigationHandle( | 1070 void RenderFrameHostImpl::SetNavigationHandle( |
| 1069 scoped_ptr<NavigationHandleImpl> navigation_handle) { | 1071 scoped_ptr<NavigationHandleImpl> navigation_handle) { |
| 1070 navigation_handle_ = navigation_handle.Pass(); | 1072 navigation_handle_ = std::move(navigation_handle); |
| 1071 if (navigation_handle_) | 1073 if (navigation_handle_) |
| 1072 navigation_handle_->set_render_frame_host(this); | 1074 navigation_handle_->set_render_frame_host(this); |
| 1073 } | 1075 } |
| 1074 | 1076 |
| 1075 scoped_ptr<NavigationHandleImpl> | 1077 scoped_ptr<NavigationHandleImpl> |
| 1076 RenderFrameHostImpl::PassNavigationHandleOwnership() { | 1078 RenderFrameHostImpl::PassNavigationHandleOwnership() { |
| 1077 DCHECK(!IsBrowserSideNavigationEnabled()); | 1079 DCHECK(!IsBrowserSideNavigationEnabled()); |
| 1078 navigation_handle_->set_is_transferring(true); | 1080 navigation_handle_->set_is_transferring(true); |
| 1079 return navigation_handle_.Pass(); | 1081 return std::move(navigation_handle_); |
| 1080 } | 1082 } |
| 1081 | 1083 |
| 1082 void RenderFrameHostImpl::OnCrossSiteResponse( | 1084 void RenderFrameHostImpl::OnCrossSiteResponse( |
| 1083 const GlobalRequestID& global_request_id, | 1085 const GlobalRequestID& global_request_id, |
| 1084 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, | 1086 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, |
| 1085 const std::vector<GURL>& transfer_url_chain, | 1087 const std::vector<GURL>& transfer_url_chain, |
| 1086 const Referrer& referrer, | 1088 const Referrer& referrer, |
| 1087 ui::PageTransition page_transition, | 1089 ui::PageTransition page_transition, |
| 1088 bool should_replace_current_entry) { | 1090 bool should_replace_current_entry) { |
| 1089 frame_tree_node_->render_manager()->OnCrossSiteResponse( | 1091 frame_tree_node_->render_manager()->OnCrossSiteResponse( |
| 1090 this, global_request_id, cross_site_transferring_request.Pass(), | 1092 this, global_request_id, std::move(cross_site_transferring_request), |
| 1091 transfer_url_chain, referrer, page_transition, | 1093 transfer_url_chain, referrer, page_transition, |
| 1092 should_replace_current_entry); | 1094 should_replace_current_entry); |
| 1093 } | 1095 } |
| 1094 | 1096 |
| 1095 void RenderFrameHostImpl::SwapOut( | 1097 void RenderFrameHostImpl::SwapOut( |
| 1096 RenderFrameProxyHost* proxy, | 1098 RenderFrameProxyHost* proxy, |
| 1097 bool is_loading) { | 1099 bool is_loading) { |
| 1098 // The end of this event is in OnSwapOutACK when the RenderFrame has completed | 1100 // The end of this event is in OnSwapOutACK when the RenderFrame has completed |
| 1099 // the operation and sends back an IPC message. | 1101 // the operation and sends back an IPC message. |
| 1100 // The trace event may not end properly if the ACK times out. We expect this | 1102 // The trace event may not end properly if the ACK times out. We expect this |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2036 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
| 2035 const ResourceResponseHead head = response ? | 2037 const ResourceResponseHead head = response ? |
| 2036 response->head : ResourceResponseHead(); | 2038 response->head : ResourceResponseHead(); |
| 2037 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2039 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
| 2038 request_params)); | 2040 request_params)); |
| 2039 // TODO(clamy): Check if we should start the throbber for non javascript urls | 2041 // TODO(clamy): Check if we should start the throbber for non javascript urls |
| 2040 // here. | 2042 // here. |
| 2041 | 2043 |
| 2042 // TODO(clamy): Release the stream handle once the renderer has finished | 2044 // TODO(clamy): Release the stream handle once the renderer has finished |
| 2043 // reading it. | 2045 // reading it. |
| 2044 stream_handle_ = body.Pass(); | 2046 stream_handle_ = std::move(body); |
| 2045 | 2047 |
| 2046 // When navigating to a Javascript url, no commit is expected from the | 2048 // When navigating to a Javascript url, no commit is expected from the |
| 2047 // RenderFrameHost, nor should the throbber start. | 2049 // RenderFrameHost, nor should the throbber start. |
| 2048 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) { | 2050 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) { |
| 2049 pending_commit_ = true; | 2051 pending_commit_ = true; |
| 2050 is_loading_ = true; | 2052 is_loading_ = true; |
| 2051 } | 2053 } |
| 2052 frame_tree_node_->ResetNavigationRequest(true); | 2054 frame_tree_node_->ResetNavigationRequest(true); |
| 2053 } | 2055 } |
| 2054 | 2056 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2080 RegisterMojoServices(); | 2082 RegisterMojoServices(); |
| 2081 RenderFrameSetupPtr setup; | 2083 RenderFrameSetupPtr setup; |
| 2082 GetProcess()->GetServiceRegistry()->ConnectToRemoteService( | 2084 GetProcess()->GetServiceRegistry()->ConnectToRemoteService( |
| 2083 mojo::GetProxy(&setup)); | 2085 mojo::GetProxy(&setup)); |
| 2084 | 2086 |
| 2085 mojo::ServiceProviderPtr exposed_services; | 2087 mojo::ServiceProviderPtr exposed_services; |
| 2086 service_registry_->Bind(GetProxy(&exposed_services)); | 2088 service_registry_->Bind(GetProxy(&exposed_services)); |
| 2087 | 2089 |
| 2088 mojo::ServiceProviderPtr services; | 2090 mojo::ServiceProviderPtr services; |
| 2089 setup->ExchangeServiceProviders(routing_id_, GetProxy(&services), | 2091 setup->ExchangeServiceProviders(routing_id_, GetProxy(&services), |
| 2090 exposed_services.Pass()); | 2092 std::move(exposed_services)); |
| 2091 service_registry_->BindRemoteServiceProvider(services.Pass()); | 2093 service_registry_->BindRemoteServiceProvider(std::move(services)); |
| 2092 | 2094 |
| 2093 #if defined(OS_ANDROID) | 2095 #if defined(OS_ANDROID) |
| 2094 service_registry_android_.reset( | 2096 service_registry_android_.reset( |
| 2095 new ServiceRegistryAndroid(service_registry_.get())); | 2097 new ServiceRegistryAndroid(service_registry_.get())); |
| 2096 ServiceRegistrarAndroid::RegisterFrameHostServices( | 2098 ServiceRegistrarAndroid::RegisterFrameHostServices( |
| 2097 service_registry_android_.get()); | 2099 service_registry_android_.get()); |
| 2098 #endif | 2100 #endif |
| 2099 } | 2101 } |
| 2100 | 2102 |
| 2101 void RenderFrameHostImpl::InvalidateMojoConnection() { | 2103 void RenderFrameHostImpl::InvalidateMojoConnection() { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 GetProcess()->GetID())); | 2187 GetProcess()->GetID())); |
| 2186 } | 2188 } |
| 2187 } | 2189 } |
| 2188 return true; | 2190 return true; |
| 2189 } | 2191 } |
| 2190 | 2192 |
| 2191 void RenderFrameHostImpl::CommitPendingWebUI() { | 2193 void RenderFrameHostImpl::CommitPendingWebUI() { |
| 2192 if (should_reuse_web_ui_) { | 2194 if (should_reuse_web_ui_) { |
| 2193 should_reuse_web_ui_ = false; | 2195 should_reuse_web_ui_ = false; |
| 2194 } else { | 2196 } else { |
| 2195 web_ui_ = pending_web_ui_.Pass(); | 2197 web_ui_ = std::move(pending_web_ui_); |
| 2196 web_ui_type_ = pending_web_ui_type_; | 2198 web_ui_type_ = pending_web_ui_type_; |
| 2197 pending_web_ui_type_ = WebUI::kNoWebUI; | 2199 pending_web_ui_type_ = WebUI::kNoWebUI; |
| 2198 } | 2200 } |
| 2199 DCHECK(!pending_web_ui_ && pending_web_ui_type_ == WebUI::kNoWebUI && | 2201 DCHECK(!pending_web_ui_ && pending_web_ui_type_ == WebUI::kNoWebUI && |
| 2200 !should_reuse_web_ui_); | 2202 !should_reuse_web_ui_); |
| 2201 } | 2203 } |
| 2202 | 2204 |
| 2203 void RenderFrameHostImpl::ClearPendingWebUI() { | 2205 void RenderFrameHostImpl::ClearPendingWebUI() { |
| 2204 pending_web_ui_.reset(); | 2206 pending_web_ui_.reset(); |
| 2205 pending_web_ui_type_ = WebUI::kNoWebUI; | 2207 pending_web_ui_type_ = WebUI::kNoWebUI; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 *dst = src; | 2519 *dst = src; |
| 2518 | 2520 |
| 2519 if (src.routing_id != -1) | 2521 if (src.routing_id != -1) |
| 2520 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2522 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
| 2521 | 2523 |
| 2522 if (src.parent_routing_id != -1) | 2524 if (src.parent_routing_id != -1) |
| 2523 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2525 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
| 2524 } | 2526 } |
| 2525 | 2527 |
| 2526 } // namespace content | 2528 } // namespace content |
| OLD | NEW |