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

Side by Side Diff: content/browser/media/android/browser_media_player_manager.cc

Issue 302453012: Support casting for embedded YT videos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged parameters into struct to avoid 2 IPC calls, updated nits Created 6 years, 6 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
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/browser/media/android/browser_media_player_manager.h" 5 #include "content/browser/media/android/browser_media_player_manager.h"
6 6
7 #include "base/android/scoped_java_ref.h" 7 #include "base/android/scoped_java_ref.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/android/content_view_core_impl.h" 10 #include "content/browser/android/content_view_core_impl.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 if (fullscreen_player_id_ == player_id) { 510 if (fullscreen_player_id_ == player_id) {
511 MediaPlayerAndroid* player = GetPlayer(player_id); 511 MediaPlayerAndroid* player = GetPlayer(player_id);
512 if (player) 512 if (player)
513 player->SetVideoSurface(gfx::ScopedJavaSurface()); 513 player->SetVideoSurface(gfx::ScopedJavaSurface());
514 video_view_->OnExitFullscreen(); 514 video_view_->OnExitFullscreen();
515 } 515 }
516 } 516 }
517 517
518 void BrowserMediaPlayerManager::OnInitialize( 518 void BrowserMediaPlayerManager::OnInitialize(
519 MediaPlayerHostMsg_Initialize_Type type, 519 MediaPlayerHostMsg_Initialize_Type type,
520 int player_id, 520 const MediaPlayerHostMsg_Initialize_Params& media_player_params) {
521 const GURL& url, 521 DCHECK(type != MEDIA_PLAYER_TYPE_MEDIA_SOURCE ||
522 const GURL& first_party_for_cookies, 522 media_player_params.demuxer_client_id > 0)
523 int demuxer_client_id) {
524 DCHECK(type != MEDIA_PLAYER_TYPE_MEDIA_SOURCE || demuxer_client_id > 0)
525 << "Media source players must have positive demuxer client IDs: " 523 << "Media source players must have positive demuxer client IDs: "
526 << demuxer_client_id; 524 << media_player_params.demuxer_client_id;
527 525
528 RemovePlayer(player_id); 526 RemovePlayer(media_player_params.player_id);
529 527
530 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( 528 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>(
531 web_contents()->GetRenderProcessHost()); 529 web_contents()->GetRenderProcessHost());
532 MediaPlayerAndroid* player = CreateMediaPlayer( 530 MediaPlayerAndroid* player = CreateMediaPlayer(
533 type, player_id, url, first_party_for_cookies, demuxer_client_id, 531 type, media_player_params.player_id, media_player_params.url,
acolwell GONE FROM CHROMIUM 2014/06/09 20:02:09 nit: Looks like you could just pass media_player_p
May 2014/06/10 18:22:19 Done.
532 media_player_params.first_party_for_cookies,
533 media_player_params.demuxer_client_id,
534 host->GetBrowserContext()->IsOffTheRecord(), this, 534 host->GetBrowserContext()->IsOffTheRecord(), this,
535 host->browser_demuxer_android()); 535 host->browser_demuxer_android());
536
536 if (!player) 537 if (!player)
537 return; 538 return;
538 539
540 player->set_frame_url(media_player_params.frame_url);
acolwell GONE FROM CHROMIUM 2014/06/09 20:02:09 nit: Any reason not to make this part of the playe
May 2014/06/10 18:22:19 Done.
539 AddPlayer(player); 541 AddPlayer(player);
540 } 542 }
541 543
542 void BrowserMediaPlayerManager::OnStart(int player_id) { 544 void BrowserMediaPlayerManager::OnStart(int player_id) {
543 MediaPlayerAndroid* player = GetPlayer(player_id); 545 MediaPlayerAndroid* player = GetPlayer(player_id);
544 if (!player) 546 if (!player)
545 return; 547 return;
546 player->Start(); 548 player->Start();
547 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { 549 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) {
548 video_view_->OpenVideo(); 550 video_view_->OpenVideo();
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 #if defined(VIDEO_HOLE) 894 #if defined(VIDEO_HOLE)
893 MediaPlayerAndroid* player = GetPlayer(player_id); 895 MediaPlayerAndroid* player = GetPlayer(player_id);
894 if (player && player->IsSurfaceInUse()) 896 if (player && player->IsSurfaceInUse())
895 return; 897 return;
896 if (external_video_surface_container_) 898 if (external_video_surface_container_)
897 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); 899 external_video_surface_container_->ReleaseExternalVideoSurface(player_id);
898 #endif // defined(VIDEO_HOLE) 900 #endif // defined(VIDEO_HOLE)
899 } 901 }
900 902
901 } // namespace content 903 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698