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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 #include "content/public/common/content_switches.h" | 81 #include "content/public/common/content_switches.h" |
82 #include "content/public/common/file_chooser_file_info.h" | 82 #include "content/public/common/file_chooser_file_info.h" |
83 #include "content/public/common/file_chooser_params.h" | 83 #include "content/public/common/file_chooser_params.h" |
84 #include "content/public/common/isolated_world_ids.h" | 84 #include "content/public/common/isolated_world_ids.h" |
85 #include "content/public/common/mojo_shell_connection.h" | 85 #include "content/public/common/mojo_shell_connection.h" |
86 #include "content/public/common/url_constants.h" | 86 #include "content/public/common/url_constants.h" |
87 #include "content/public/common/url_utils.h" | 87 #include "content/public/common/url_utils.h" |
88 #include "device/generic_sensor/sensor_provider_impl.h" | 88 #include "device/generic_sensor/sensor_provider_impl.h" |
89 #include "device/geolocation/geolocation_service_context.h" | 89 #include "device/geolocation/geolocation_service_context.h" |
90 #include "device/vibration/vibration_manager_impl.h" | 90 #include "device/vibration/vibration_manager_impl.h" |
91 #include "media/media_features.h" | |
91 #include "media/mojo/interfaces/media_service.mojom.h" | 92 #include "media/mojo/interfaces/media_service.mojom.h" |
92 #include "media/mojo/interfaces/service_factory.mojom.h" | 93 #include "media/mojo/interfaces/service_factory.mojom.h" |
93 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 94 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
95 #include "mojo/public/cpp/bindings/strong_binding.h" | |
94 #include "services/shell/public/cpp/connector.h" | 96 #include "services/shell/public/cpp/connector.h" |
95 #include "services/shell/public/cpp/interface_provider.h" | 97 #include "services/shell/public/cpp/interface_provider.h" |
96 #include "ui/accessibility/ax_tree.h" | 98 #include "ui/accessibility/ax_tree.h" |
97 #include "ui/accessibility/ax_tree_update.h" | 99 #include "ui/accessibility/ax_tree_update.h" |
98 #include "ui/gfx/geometry/quad_f.h" | 100 #include "ui/gfx/geometry/quad_f.h" |
99 #include "url/gurl.h" | 101 #include "url/gurl.h" |
100 | 102 |
101 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
102 #include "content/public/browser/android/java_interfaces.h" | 104 #include "content/public/browser/android/java_interfaces.h" |
103 #if defined(ENABLE_MOJO_CDM) | 105 #if defined(ENABLE_MOJO_CDM) |
104 #include "content/browser/media/android/provision_fetcher_impl.h" | 106 #include "content/browser/media/android/provision_fetcher_impl.h" |
105 #endif | 107 #endif |
106 #endif | 108 #endif |
107 | 109 |
110 #if BUILDFLAG(ENABLE_MOJO_MEDIA_PLAYER_RENDERER) | |
111 #include "content/browser/media/android/media_player_renderer.h" | |
112 // TODO(tguilbert): For-reviewers -- Is there a convenient way to get rid of the | |
113 // dependency on these files? MojoRendererService complains about incomplete | |
114 // types because there is no move ctor define, but they aren't actually used... | |
115 #include "media/base/audio_renderer_sink.h" | |
116 #include "media/base/video_renderer_sink.h" | |
117 #include "media/mojo/services/mojo_renderer_service.h" | |
118 #endif | |
119 | |
108 #if defined(OS_MACOSX) | 120 #if defined(OS_MACOSX) |
109 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 121 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
110 #endif | 122 #endif |
111 | 123 |
112 #if defined(ENABLE_WEBVR) | 124 #if defined(ENABLE_WEBVR) |
113 #include "base/command_line.h" | 125 #include "base/command_line.h" |
114 #include "content/public/common/content_switches.h" | 126 #include "content/public/common/content_switches.h" |
115 #include "device/vr/vr_service_impl.h" // nogncheck | 127 #include "device/vr/vr_service_impl.h" // nogncheck |
116 #endif | 128 #endif |
117 | 129 |
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2101 } | 2113 } |
2102 | 2114 |
2103 void RenderFrameHostImpl::OnHidePopup() { | 2115 void RenderFrameHostImpl::OnHidePopup() { |
2104 RenderViewHostDelegateView* view = | 2116 RenderViewHostDelegateView* view = |
2105 render_view_host_->delegate_->GetDelegateView(); | 2117 render_view_host_->delegate_->GetDelegateView(); |
2106 if (view) | 2118 if (view) |
2107 view->HidePopupMenu(); | 2119 view->HidePopupMenu(); |
2108 } | 2120 } |
2109 #endif | 2121 #endif |
2110 | 2122 |
2123 #if BUILDFLAG(ENABLE_MOJO_MEDIA_PLAYER_RENDERER) | |
liberato (no reviews please)
2016/10/06 14:55:46
have you considered a runtime flag instead of (or
tguilbert
2016/10/11 18:54:33
Added.
| |
2124 void CreateMediaPlayerRenderer( | |
2125 content::RenderFrameHost* render_frame_host, | |
2126 mojo::InterfaceRequest<media::mojom::Renderer> request) { | |
2127 std::unique_ptr<MediaPlayerRenderer> renderer = | |
2128 base::MakeUnique<MediaPlayerRenderer>(render_frame_host); | |
2129 | |
2130 // base::Unretained is safe here because the lifetime of the MediaPlayerRender | |
2131 // is tied to the lifetime of the MojoRendererService. | |
2132 media::MojoRendererService::InitiateSurfaceRequestCB surface_request_cb = | |
2133 base::Bind(&MediaPlayerRenderer::InitiateScopedSurfaceRequest, | |
2134 base::Unretained(renderer.get())); | |
2135 | |
2136 media::MojoRendererService::Create(nullptr, nullptr, nullptr, | |
2137 std::move(renderer), surface_request_cb, | |
2138 std::move(request)); | |
2139 } | |
2140 #endif | |
2141 | |
2111 void RenderFrameHostImpl::RegisterMojoInterfaces() { | 2142 void RenderFrameHostImpl::RegisterMojoInterfaces() { |
2112 device::GeolocationServiceContext* geolocation_service_context = | 2143 device::GeolocationServiceContext* geolocation_service_context = |
2113 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 2144 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
2114 if (geolocation_service_context) { | 2145 if (geolocation_service_context) { |
2115 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 2146 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
2116 // can perform permissions checks once site isolation is complete. | 2147 // can perform permissions checks once site isolation is complete. |
2117 // crbug.com/426384 | 2148 // crbug.com/426384 |
2118 // NOTE: At shutdown, there is no guaranteed ordering between destruction of | 2149 // NOTE: At shutdown, there is no guaranteed ordering between destruction of |
2119 // this object and destruction of any GeolocationServicesImpls created via | 2150 // this object and destruction of any GeolocationServicesImpls created via |
2120 // the below service registry, the reason being that the destruction of the | 2151 // the below service registry, the reason being that the destruction of the |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2189 base::Bind(&device::VRServiceImpl::BindRequest)); | 2220 base::Bind(&device::VRServiceImpl::BindRequest)); |
2190 } | 2221 } |
2191 #endif | 2222 #endif |
2192 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2223 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
2193 switches::kEnableGenericSensors)) { | 2224 switches::kEnableGenericSensors)) { |
2194 GetInterfaceRegistry()->AddInterface( | 2225 GetInterfaceRegistry()->AddInterface( |
2195 base::Bind(&device::SensorProviderImpl::Create), | 2226 base::Bind(&device::SensorProviderImpl::Create), |
2196 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 2227 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
2197 } | 2228 } |
2198 | 2229 |
2230 #if BUILDFLAG(ENABLE_MOJO_MEDIA_PLAYER_RENDERER) | |
2231 // Creates a MojoRendererService, passing it a MediaPlayerRender. | |
2232 GetInterfaceRegistry()->AddInterface<media::mojom::Renderer>( | |
2233 base::Bind(&content::CreateMediaPlayerRenderer, base::Unretained(this))); | |
2234 #endif | |
2235 | |
2199 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces( | 2236 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces( |
2200 GetInterfaceRegistry(), this); | 2237 GetInterfaceRegistry(), this); |
2201 } | 2238 } |
2202 | 2239 |
2203 void RenderFrameHostImpl::ResetWaitingState() { | 2240 void RenderFrameHostImpl::ResetWaitingState() { |
2204 DCHECK(is_active()); | 2241 DCHECK(is_active()); |
2205 | 2242 |
2206 // Whenever we reset the RFH state, we should not be waiting for beforeunload | 2243 // Whenever we reset the RFH state, we should not be waiting for beforeunload |
2207 // or close acks. We clear them here to be safe, since they can cause | 2244 // or close acks. We clear them here to be safe, since they can cause |
2208 // navigations to be ignored in OnDidCommitProvisionalLoad. | 2245 // navigations to be ignored in OnDidCommitProvisionalLoad. |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3088 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3125 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3089 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3126 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3090 return web_bluetooth_service_.get(); | 3127 return web_bluetooth_service_.get(); |
3091 } | 3128 } |
3092 | 3129 |
3093 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3130 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3094 web_bluetooth_service_.reset(); | 3131 web_bluetooth_service_.reset(); |
3095 } | 3132 } |
3096 | 3133 |
3097 } // namespace content | 3134 } // namespace content |
OLD | NEW |