| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "content/browser/frame_host/frame_tree_node.h" | 31 #include "content/browser/frame_host/frame_tree_node.h" |
| 32 #include "content/browser/frame_host/navigation_entry_impl.h" | 32 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 33 #include "content/browser/frame_host/navigation_handle_impl.h" | 33 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 34 #include "content/browser/frame_host/navigation_request.h" | 34 #include "content/browser/frame_host/navigation_request.h" |
| 35 #include "content/browser/frame_host/navigator.h" | 35 #include "content/browser/frame_host/navigator.h" |
| 36 #include "content/browser/frame_host/navigator_impl.h" | 36 #include "content/browser/frame_host/navigator_impl.h" |
| 37 #include "content/browser/frame_host/render_frame_host_delegate.h" | 37 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 38 #include "content/browser/frame_host/render_frame_proxy_host.h" | 38 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 39 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 39 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 40 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 40 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 41 #include "content/browser/media/media_interface_proxy.h" |
| 41 #include "content/browser/media/session/media_session_service_impl.h" | 42 #include "content/browser/media/session/media_session_service_impl.h" |
| 42 #include "content/browser/permissions/permission_service_context.h" | 43 #include "content/browser/permissions/permission_service_context.h" |
| 43 #include "content/browser/permissions/permission_service_impl.h" | 44 #include "content/browser/permissions/permission_service_impl.h" |
| 44 #include "content/browser/presentation/presentation_service_impl.h" | 45 #include "content/browser/presentation/presentation_service_impl.h" |
| 45 #include "content/browser/renderer_host/input/input_router_impl.h" | 46 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 46 #include "content/browser/renderer_host/input/timeout_monitor.h" | 47 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 47 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h" | 48 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h" |
| 48 #include "content/browser/renderer_host/render_process_host_impl.h" | 49 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 49 #include "content/browser/renderer_host/render_view_host_delegate.h" | 50 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 50 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 51 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 #include "content/browser/media/android/media_player_renderer.h" | 117 #include "content/browser/media/android/media_player_renderer.h" |
| 117 #include "media/base/audio_renderer_sink.h" | 118 #include "media/base/audio_renderer_sink.h" |
| 118 #include "media/base/video_renderer_sink.h" | 119 #include "media/base/video_renderer_sink.h" |
| 119 #include "media/mojo/services/mojo_renderer_service.h" // nogncheck | 120 #include "media/mojo/services/mojo_renderer_service.h" // nogncheck |
| 120 #endif | 121 #endif |
| 121 | 122 |
| 122 #if defined(OS_MACOSX) | 123 #if defined(OS_MACOSX) |
| 123 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 124 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
| 124 #endif | 125 #endif |
| 125 | 126 |
| 126 #if defined(ENABLE_MOJO_CDM) | |
| 127 #include "content/public/browser/provision_fetcher_impl.h" | |
| 128 #endif | |
| 129 | |
| 130 #if defined(ENABLE_WEBVR) | 127 #if defined(ENABLE_WEBVR) |
| 131 #include "device/vr/vr_service_impl.h" // nogncheck | 128 #include "device/vr/vr_service_impl.h" // nogncheck |
| 132 #endif | 129 #endif |
| 133 | 130 |
| 134 using base::TimeDelta; | 131 using base::TimeDelta; |
| 135 | 132 |
| 136 namespace content { | 133 namespace content { |
| 137 | 134 |
| 138 namespace { | 135 namespace { |
| 139 | 136 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 DCHECK_EQ(site_instance_.get(), site_instance); | 846 DCHECK_EQ(site_instance_.get(), site_instance); |
| 850 | 847 |
| 851 // The renderer process is gone, so this frame can no longer be loading. | 848 // The renderer process is gone, so this frame can no longer be loading. |
| 852 ResetLoadingState(); | 849 ResetLoadingState(); |
| 853 | 850 |
| 854 // Any future UpdateState or UpdateTitle messages from this or a recreated | 851 // Any future UpdateState or UpdateTitle messages from this or a recreated |
| 855 // process should be ignored until the next commit. | 852 // process should be ignored until the next commit. |
| 856 set_nav_entry_id(0); | 853 set_nav_entry_id(0); |
| 857 } | 854 } |
| 858 | 855 |
| 859 void RenderFrameHostImpl::Create( | |
| 860 const service_manager::Identity& remote_identity, | |
| 861 media::mojom::InterfaceFactoryRequest request) { | |
| 862 auto registry = base::MakeUnique<service_manager::InterfaceRegistry>( | |
| 863 std::string()); | |
| 864 #if defined(ENABLE_MOJO_CDM) | |
| 865 net::URLRequestContextGetter* context_getter = | |
| 866 BrowserContext::GetDefaultStoragePartition( | |
| 867 GetProcess()->GetBrowserContext()) | |
| 868 ->GetURLRequestContext(); | |
| 869 registry->AddInterface( | |
| 870 base::Bind(&ProvisionFetcherImpl::Create, context_getter)); | |
| 871 #endif // defined(ENABLE_MOJO_CDM) | |
| 872 GetContentClient()->browser()->ExposeInterfacesToMediaService(registry.get(), | |
| 873 this); | |
| 874 service_manager::mojom::InterfaceProviderPtr interfaces; | |
| 875 registry->Bind(GetProxy(&interfaces), | |
| 876 service_manager::Identity(), | |
| 877 service_manager::InterfaceProviderSpec(), | |
| 878 service_manager::Identity(), | |
| 879 service_manager::InterfaceProviderSpec()); | |
| 880 media_registries_.push_back(std::move(registry)); | |
| 881 | |
| 882 // TODO(slan): Use the BrowserContext Connector instead. See crbug.com/638950. | |
| 883 media::mojom::MediaServicePtr media_service; | |
| 884 service_manager::Connector* connector = | |
| 885 ServiceManagerConnection::GetForProcess()->GetConnector(); | |
| 886 connector->ConnectToInterface("media", &media_service); | |
| 887 media_service->CreateInterfaceFactory(std::move(request), | |
| 888 std::move(interfaces)); | |
| 889 } | |
| 890 | |
| 891 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id, | 856 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id, |
| 892 int opener_routing_id, | 857 int opener_routing_id, |
| 893 int parent_routing_id, | 858 int parent_routing_id, |
| 894 int previous_sibling_routing_id) { | 859 int previous_sibling_routing_id) { |
| 895 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame"); | 860 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame"); |
| 896 DCHECK(!IsRenderFrameLive()) << "Creating frame twice"; | 861 DCHECK(!IsRenderFrameLive()) << "Creating frame twice"; |
| 897 | 862 |
| 898 // The process may (if we're sharing a process with another host that already | 863 // The process may (if we're sharing a process with another host that already |
| 899 // initialized it) or may not (we have our own process or the old process | 864 // initialized it) or may not (we have our own process or the old process |
| 900 // crashed) have been initialized. Calling Init multiple times will be | 865 // crashed) have been initialized. Calling Init multiple times will be |
| (...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 3219 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
| 3255 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3220 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3256 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3221 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3257 return web_bluetooth_service_.get(); | 3222 return web_bluetooth_service_.get(); |
| 3258 } | 3223 } |
| 3259 | 3224 |
| 3260 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3225 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3261 web_bluetooth_service_.reset(); | 3226 web_bluetooth_service_.reset(); |
| 3262 } | 3227 } |
| 3263 | 3228 |
| 3229 void RenderFrameHostImpl::Create( |
| 3230 const service_manager::Identity& remote_identity, |
| 3231 media::mojom::InterfaceFactoryRequest request) { |
| 3232 DCHECK(!media_interface_proxy_); |
| 3233 media_interface_proxy_.reset(new MediaInterfaceProxy( |
| 3234 this, std::move(request), |
| 3235 base::Bind(&RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError, |
| 3236 base::Unretained(this)))); |
| 3237 } |
| 3238 |
| 3239 void RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError() { |
| 3240 DCHECK(media_interface_proxy_); |
| 3241 media_interface_proxy_.reset(); |
| 3242 } |
| 3243 |
| 3264 std::unique_ptr<NavigationHandleImpl> | 3244 std::unique_ptr<NavigationHandleImpl> |
| 3265 RenderFrameHostImpl::TakeNavigationHandleForCommit( | 3245 RenderFrameHostImpl::TakeNavigationHandleForCommit( |
| 3266 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 3246 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 3267 // If this is a same-page navigation, there isn't an existing NavigationHandle | 3247 // If this is a same-page navigation, there isn't an existing NavigationHandle |
| 3268 // to use for the navigation. Create one, but don't reset any NavigationHandle | 3248 // to use for the navigation. Create one, but don't reset any NavigationHandle |
| 3269 // tracking an ongoing navigation, since this may lead to the cancellation of | 3249 // tracking an ongoing navigation, since this may lead to the cancellation of |
| 3270 // the navigation. | 3250 // the navigation. |
| 3271 if (params.was_within_same_page) { | 3251 if (params.was_within_same_page) { |
| 3272 // We don't ever expect navigation_handle_ to match, because handles are not | 3252 // We don't ever expect navigation_handle_ to match, because handles are not |
| 3273 // created for same-page navigations. | 3253 // created for same-page navigations. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3321 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3342 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3322 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3343 return NavigationHandleImpl::Create( | 3323 return NavigationHandleImpl::Create( |
| 3344 params.url, frame_tree_node_, is_renderer_initiated, | 3324 params.url, frame_tree_node_, is_renderer_initiated, |
| 3345 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), | 3325 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), |
| 3346 entry_id_for_data_nav, params.gesture, | 3326 entry_id_for_data_nav, params.gesture, |
| 3347 false); // started_from_context_menu | 3327 false); // started_from_context_menu |
| 3348 } | 3328 } |
| 3349 | 3329 |
| 3350 } // namespace content | 3330 } // namespace content |
| OLD | NEW |