Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1436243002: Add render-side manager for MediaSession (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 #include "content/renderer/media/rtc_peer_connection_handler.h" 173 #include "content/renderer/media/rtc_peer_connection_handler.h"
174 #endif 174 #endif
175 175
176 #if defined(OS_ANDROID) 176 #if defined(OS_ANDROID)
177 #include <cpu-features.h> 177 #include <cpu-features.h>
178 178
179 #include "content/common/gpu/client/context_provider_command_buffer.h" 179 #include "content/common/gpu/client/context_provider_command_buffer.h"
180 #include "content/renderer/android/synchronous_compositor_factory.h" 180 #include "content/renderer/android/synchronous_compositor_factory.h"
181 #include "content/renderer/java/gin_java_bridge_dispatcher.h" 181 #include "content/renderer/java/gin_java_bridge_dispatcher.h"
182 #include "content/renderer/media/android/renderer_media_player_manager.h" 182 #include "content/renderer/media/android/renderer_media_player_manager.h"
183 #include "content/renderer/media/android/renderer_media_session_manager.h"
183 #include "content/renderer/media/android/stream_texture_factory_impl.h" 184 #include "content/renderer/media/android/stream_texture_factory_impl.h"
184 #include "content/renderer/media/android/webmediaplayer_android.h" 185 #include "content/renderer/media/android/webmediaplayer_android.h"
185 #include "content/renderer/media/android/webmediasession_android.h" 186 #include "content/renderer/media/android/webmediasession_android.h"
186 #else 187 #else
187 #include "cc/blink/context_provider_web_context.h" 188 #include "cc/blink/context_provider_web_context.h"
188 #include "content/renderer/usb/web_usb_client_impl.h" 189 #include "content/renderer/usb/web_usb_client_impl.h"
189 #include "device/devices_app/public/cpp/constants.h" 190 #include "device/devices_app/public/cpp/constants.h"
190 #endif 191 #endif
191 192
192 #if defined(ENABLE_PEPPER_CDMS) 193 #if defined(ENABLE_PEPPER_CDMS)
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 cookie_jar_(this), 745 cookie_jar_(this),
745 selection_text_offset_(0), 746 selection_text_offset_(0),
746 selection_range_(gfx::Range::InvalidRange()), 747 selection_range_(gfx::Range::InvalidRange()),
747 handling_select_range_(false), 748 handling_select_range_(false),
748 notification_permission_dispatcher_(NULL), 749 notification_permission_dispatcher_(NULL),
749 web_user_media_client_(NULL), 750 web_user_media_client_(NULL),
750 media_permission_dispatcher_(NULL), 751 media_permission_dispatcher_(NULL),
751 midi_dispatcher_(NULL), 752 midi_dispatcher_(NULL),
752 #if defined(OS_ANDROID) 753 #if defined(OS_ANDROID)
753 media_player_manager_(NULL), 754 media_player_manager_(NULL),
755 media_session_manager_(NULL),
754 #endif 756 #endif
755 #if defined(ENABLE_BROWSER_CDMS) 757 #if defined(ENABLE_BROWSER_CDMS)
756 cdm_manager_(NULL), 758 cdm_manager_(NULL),
757 #endif 759 #endif
758 #if defined(VIDEO_HOLE) 760 #if defined(VIDEO_HOLE)
759 contains_media_player_(false), 761 contains_media_player_(false),
760 #endif 762 #endif
761 devtools_agent_(nullptr), 763 devtools_agent_(nullptr),
762 wakelock_dispatcher_(nullptr), 764 wakelock_dispatcher_(nullptr),
763 geolocation_dispatcher_(NULL), 765 geolocation_dispatcher_(NULL),
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 // !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) 2214 // !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
2213 2215
2214 return new media::WebMediaPlayerImpl( 2216 return new media::WebMediaPlayerImpl(
2215 frame, client, encrypted_client, GetWebMediaPlayerDelegate()->AsWeakPtr(), 2217 frame, client, encrypted_client, GetWebMediaPlayerDelegate()->AsWeakPtr(),
2216 media_renderer_factory.Pass(), GetCdmFactory(), params); 2218 media_renderer_factory.Pass(), GetCdmFactory(), params);
2217 #endif // defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) 2219 #endif // defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
2218 } 2220 }
2219 2221
2220 blink::WebMediaSession* RenderFrameImpl::createMediaSession() { 2222 blink::WebMediaSession* RenderFrameImpl::createMediaSession() {
2221 #if defined(OS_ANDROID) 2223 #if defined(OS_ANDROID)
2222 return new WebMediaSessionAndroid(); 2224 return new WebMediaSessionAndroid(GetMediaSessionManager());
2223 #else 2225 #else
2224 return nullptr; 2226 return nullptr;
2225 #endif // defined(OS_ANDROID) 2227 #endif // defined(OS_ANDROID)
2226 } 2228 }
2227 2229
2228 blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost( 2230 blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost(
2229 blink::WebLocalFrame* frame, 2231 blink::WebLocalFrame* frame,
2230 blink::WebApplicationCacheHostClient* client) { 2232 blink::WebApplicationCacheHostClient* client) {
2231 if (!frame || !frame->view()) 2233 if (!frame || !frame->view())
2232 return NULL; 2234 return NULL;
(...skipping 3011 matching lines...) Expand 10 before | Expand all | Expand 10 after
5244 GetWebMediaPlayerDelegate()->AsWeakPtr(), 5246 GetWebMediaPlayerDelegate()->AsWeakPtr(),
5245 GetMediaPlayerManager(), GetCdmFactory(), 5247 GetMediaPlayerManager(), GetCdmFactory(),
5246 stream_texture_factory, routing_id_, params); 5248 stream_texture_factory, routing_id_, params);
5247 } 5249 }
5248 5250
5249 RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() { 5251 RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() {
5250 if (!media_player_manager_) 5252 if (!media_player_manager_)
5251 media_player_manager_ = new RendererMediaPlayerManager(this); 5253 media_player_manager_ = new RendererMediaPlayerManager(this);
5252 return media_player_manager_; 5254 return media_player_manager_;
5253 } 5255 }
5256
5257 RendererMediaSessionManager* RenderFrameImpl::GetMediaSessionManager() {
5258 if (!media_session_manager_)
5259 media_session_manager_ = new RendererMediaSessionManager(this);
5260 return media_session_manager_;
5261 }
5262
5254 #endif // defined(OS_ANDROID) 5263 #endif // defined(OS_ANDROID)
5255 5264
5256 scoped_ptr<media::MediaPermission> RenderFrameImpl::CreateMediaPermissionProxy( 5265 scoped_ptr<media::MediaPermission> RenderFrameImpl::CreateMediaPermissionProxy(
5257 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner) { 5266 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner) {
5258 MediaPermissionDispatcherImpl* media_permission = 5267 MediaPermissionDispatcherImpl* media_permission =
5259 static_cast<MediaPermissionDispatcherImpl*>(GetMediaPermission()); 5268 static_cast<MediaPermissionDispatcherImpl*>(GetMediaPermission());
5260 return media_permission->CreateProxy(caller_task_runner).Pass(); 5269 return media_permission->CreateProxy(caller_task_runner).Pass();
5261 } 5270 }
5262 5271
5263 media::MediaPermission* RenderFrameImpl::GetMediaPermission() { 5272 media::MediaPermission* RenderFrameImpl::GetMediaPermission() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 media::ConvertToSwitchOutputDeviceCB(web_callbacks); 5370 media::ConvertToSwitchOutputDeviceCB(web_callbacks);
5362 scoped_refptr<media::AudioOutputDevice> device = 5371 scoped_refptr<media::AudioOutputDevice> device =
5363 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), 5372 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(),
5364 security_origin); 5373 security_origin);
5365 media::OutputDeviceStatus status = device->GetDeviceStatus(); 5374 media::OutputDeviceStatus status = device->GetDeviceStatus();
5366 device->Stop(); 5375 device->Stop();
5367 callback.Run(status); 5376 callback.Run(status);
5368 } 5377 }
5369 5378
5370 } // namespace content 5379 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698