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

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

Issue 887873003: media: Add DefaultMediaPermission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 10 months 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | media/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 render_view_->RegisterVideoHoleFrame(this); 1904 render_view_->RegisterVideoHoleFrame(this);
1905 contains_media_player_ = true; 1905 contains_media_player_ = true;
1906 } 1906 }
1907 #endif // defined(VIDEO_HOLE) 1907 #endif // defined(VIDEO_HOLE)
1908 1908
1909 blink::WebMediaStream web_stream( 1909 blink::WebMediaStream web_stream(
1910 blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url)); 1910 blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
1911 if (!web_stream.isNull()) 1911 if (!web_stream.isNull())
1912 return CreateWebMediaPlayerForMediaStream(url, client); 1912 return CreateWebMediaPlayerForMediaStream(url, client);
1913 1913
1914 if (!media_permission_dispatcher_)
1915 media_permission_dispatcher_ = new MediaPermissionDispatcher(this);
1916
1914 #if defined(OS_ANDROID) 1917 #if defined(OS_ANDROID)
1915 return CreateAndroidWebMediaPlayer(url, client, initial_cdm); 1918 return CreateAndroidWebMediaPlayer(url, client, media_permission_dispatcher_,
1919 initial_cdm);
1916 #else 1920 #else
1917 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog()); 1921 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog());
1918 1922
1923
1919 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 1924 RenderThreadImpl* render_thread = RenderThreadImpl::current();
1920 media::WebMediaPlayerParams params( 1925 media::WebMediaPlayerParams params(
1921 base::Bind(&ContentRendererClient::DeferMediaLoad, 1926 base::Bind(&ContentRendererClient::DeferMediaLoad,
1922 base::Unretained(GetContentClient()->renderer()), 1927 base::Unretained(GetContentClient()->renderer()),
1923 static_cast<RenderFrame*>(this)), 1928 static_cast<RenderFrame*>(this)),
1924 render_thread->GetAudioRendererMixerManager()->CreateInput( 1929 render_thread->GetAudioRendererMixerManager()->CreateInput(
1925 render_view_->routing_id_, routing_id_), 1930 render_view_->routing_id_, routing_id_),
1926 media_log, render_thread->GetMediaThreadTaskRunner(), 1931 media_log, render_thread->GetMediaThreadTaskRunner(),
1927 render_thread->compositor_message_loop_proxy(), 1932 render_thread->compositor_message_loop_proxy(),
1928 base::Bind(&GetSharedMainThreadContext3D), initial_cdm); 1933 base::Bind(&GetSharedMainThreadContext3D), media_permission_dispatcher_,
1934 initial_cdm);
1929 1935
1930 #if defined(ENABLE_PEPPER_CDMS) 1936 #if defined(ENABLE_PEPPER_CDMS)
1931 scoped_ptr<media::CdmFactory> cdm_factory( 1937 scoped_ptr<media::CdmFactory> cdm_factory(
1932 new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame))); 1938 new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame)));
1933 #elif defined(ENABLE_BROWSER_CDMS) 1939 #elif defined(ENABLE_BROWSER_CDMS)
1934 scoped_ptr<media::CdmFactory> cdm_factory( 1940 scoped_ptr<media::CdmFactory> cdm_factory(
1935 new RenderCdmFactory(GetCdmManager())); 1941 new RenderCdmFactory(GetCdmManager()));
1936 #else 1942 #else
1937 scoped_ptr<media::CdmFactory> cdm_factory(new RenderCdmFactory()); 1943 scoped_ptr<media::CdmFactory> cdm_factory(new RenderCdmFactory());
1938 #endif 1944 #endif
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 #if defined(ENABLE_PEPPER_CDMS) 3413 #if defined(ENABLE_PEPPER_CDMS)
3408 scoped_ptr<media::CdmFactory> cdm_factory( 3414 scoped_ptr<media::CdmFactory> cdm_factory(
3409 new RenderCdmFactory(base::Bind(PepperCdmWrapperImpl::Create, frame_))); 3415 new RenderCdmFactory(base::Bind(PepperCdmWrapperImpl::Create, frame_)));
3410 #elif defined(ENABLE_BROWSER_CDMS) 3416 #elif defined(ENABLE_BROWSER_CDMS)
3411 scoped_ptr<media::CdmFactory> cdm_factory( 3417 scoped_ptr<media::CdmFactory> cdm_factory(
3412 new RenderCdmFactory(GetCdmManager())); 3418 new RenderCdmFactory(GetCdmManager()));
3413 #else 3419 #else
3414 scoped_ptr<media::CdmFactory> cdm_factory(new RenderCdmFactory()); 3420 scoped_ptr<media::CdmFactory> cdm_factory(new RenderCdmFactory());
3415 #endif 3421 #endif
3416 3422
3417 DCHECK(!media_permission_dispatcher_); 3423 if (!media_permission_dispatcher_)
3418 media_permission_dispatcher_ = new MediaPermissionDispatcher(this); 3424 media_permission_dispatcher_ = new MediaPermissionDispatcher(this);
3419 3425
3420 web_encrypted_media_client_.reset(new media::WebEncryptedMediaClientImpl( 3426 web_encrypted_media_client_.reset(new media::WebEncryptedMediaClientImpl(
3421 cdm_factory.Pass(), media_permission_dispatcher_)); 3427 cdm_factory.Pass(), media_permission_dispatcher_));
3422 } 3428 }
3423 return web_encrypted_media_client_.get(); 3429 return web_encrypted_media_client_.get();
3424 } 3430 }
3425 3431
3426 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() { 3432 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() {
3427 if (!midi_dispatcher_) 3433 if (!midi_dispatcher_)
3428 midi_dispatcher_ = new MidiDispatcher(this); 3434 midi_dispatcher_ = new MidiDispatcher(this);
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
4414 4420
4415 const WebURLRequest& request = ds->request(); 4421 const WebURLRequest& request = ds->request();
4416 return request.url(); 4422 return request.url();
4417 } 4423 }
4418 4424
4419 #if defined(OS_ANDROID) 4425 #if defined(OS_ANDROID)
4420 4426
4421 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( 4427 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer(
4422 const blink::WebURL& url, 4428 const blink::WebURL& url,
4423 WebMediaPlayerClient* client, 4429 WebMediaPlayerClient* client,
4430 media::MediaPermission* media_permission,
4424 blink::WebContentDecryptionModule* initial_cdm) { 4431 blink::WebContentDecryptionModule* initial_cdm) {
4425 GpuChannelHost* gpu_channel_host = 4432 GpuChannelHost* gpu_channel_host =
4426 RenderThreadImpl::current()->EstablishGpuChannelSync( 4433 RenderThreadImpl::current()->EstablishGpuChannelSync(
4427 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); 4434 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE);
4428 if (!gpu_channel_host) { 4435 if (!gpu_channel_host) {
4429 LOG(ERROR) << "Failed to establish GPU channel for media player"; 4436 LOG(ERROR) << "Failed to establish GPU channel for media player";
4430 return NULL; 4437 return NULL;
4431 } 4438 }
4432 4439
4433 scoped_refptr<StreamTextureFactory> stream_texture_factory; 4440 scoped_refptr<StreamTextureFactory> stream_texture_factory;
(...skipping 12 matching lines...) Expand all
4446 stream_texture_factory = StreamTextureFactoryImpl::Create( 4453 stream_texture_factory = StreamTextureFactoryImpl::Create(
4447 context_provider, gpu_channel_host, routing_id_); 4454 context_provider, gpu_channel_host, routing_id_);
4448 } 4455 }
4449 4456
4450 return new WebMediaPlayerAndroid( 4457 return new WebMediaPlayerAndroid(
4451 frame_, 4458 frame_,
4452 client, 4459 client,
4453 weak_factory_.GetWeakPtr(), 4460 weak_factory_.GetWeakPtr(),
4454 GetMediaPlayerManager(), 4461 GetMediaPlayerManager(),
4455 GetCdmManager(), 4462 GetCdmManager(),
4463 media_permission,
4456 initial_cdm, 4464 initial_cdm,
4457 stream_texture_factory, 4465 stream_texture_factory,
4458 RenderThreadImpl::current()->GetMediaThreadTaskRunner(), 4466 RenderThreadImpl::current()->GetMediaThreadTaskRunner(),
4459 new RenderMediaLog()); 4467 new RenderMediaLog());
4460 } 4468 }
4461 4469
4462 RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() { 4470 RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() {
4463 if (!media_player_manager_) 4471 if (!media_player_manager_)
4464 media_player_manager_ = new RendererMediaPlayerManager(this); 4472 media_player_manager_ = new RendererMediaPlayerManager(this);
4465 return media_player_manager_; 4473 return media_player_manager_;
4466 } 4474 }
4467 4475
4468 #endif // defined(OS_ANDROID) 4476 #endif // defined(OS_ANDROID)
4469 4477
4470 #if defined(ENABLE_BROWSER_CDMS) 4478 #if defined(ENABLE_BROWSER_CDMS)
4471 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4479 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4472 if (!cdm_manager_) 4480 if (!cdm_manager_)
4473 cdm_manager_ = new RendererCdmManager(this); 4481 cdm_manager_ = new RendererCdmManager(this);
4474 return cdm_manager_; 4482 return cdm_manager_;
4475 } 4483 }
4476 #endif // defined(ENABLE_BROWSER_CDMS) 4484 #endif // defined(ENABLE_BROWSER_CDMS)
4477 4485
4478 } // namespace content 4486 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698