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/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 "content/browser/android/content_view_core_impl.h" | 9 #include "content/browser/android/content_view_core_impl.h" |
10 #include "content/browser/android/media_players_observer.h" | 10 #include "content/browser/android/media_players_observer.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 MediaPlayerAndroid* BrowserMediaPlayerManager::GetPlayer(int player_id) { | 329 MediaPlayerAndroid* BrowserMediaPlayerManager::GetPlayer(int player_id) { |
330 for (ScopedVector<MediaPlayerAndroid>::iterator it = players_.begin(); | 330 for (ScopedVector<MediaPlayerAndroid>::iterator it = players_.begin(); |
331 it != players_.end(); ++it) { | 331 it != players_.end(); ++it) { |
332 if ((*it)->player_id() == player_id) | 332 if ((*it)->player_id() == player_id) |
333 return *it; | 333 return *it; |
334 } | 334 } |
335 return NULL; | 335 return NULL; |
336 } | 336 } |
337 | 337 |
338 void BrowserMediaPlayerManager::RequestFullScreen(int player_id) { | |
339 if (fullscreen_player_id_ == player_id) | |
340 return; | |
341 | |
342 if (fullscreen_player_id_ != kInvalidMediaPlayerId) { | |
343 // TODO(qinmin): Determine the correct error code we should report to WMPA. | |
344 OnError(player_id, MediaPlayerAndroid::MEDIA_ERROR_DECODE); | |
345 return; | |
346 } | |
347 | |
348 Send(new MediaPlayerMsg_RequestFullscreen(RoutingID(), player_id)); | |
349 } | |
350 | |
351 bool BrowserMediaPlayerManager::RequestPlay(int player_id) { | 338 bool BrowserMediaPlayerManager::RequestPlay(int player_id) { |
352 MediaPlayerAndroid* player = GetPlayer(player_id); | 339 MediaPlayerAndroid* player = GetPlayer(player_id); |
353 DCHECK(player); | 340 DCHECK(player); |
354 | 341 |
355 MediaSession::Type media_session_type = | 342 MediaSession::Type media_session_type = |
356 player->GetDuration().InSeconds() > kMinimumDurationForContentInSeconds | 343 player->GetDuration().InSeconds() > kMinimumDurationForContentInSeconds |
357 ? MediaSession::Type::Content : MediaSession::Type::Transient; | 344 ? MediaSession::Type::Content : MediaSession::Type::Transient; |
358 | 345 |
359 bool succeeded = MediaSession::Get(web_contents())->AddPlayer( | 346 bool succeeded = MediaSession::Get(web_contents())->AddPlayer( |
360 this, player_id, media_session_type); | 347 this, player_id, media_session_type); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); | 646 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); |
660 #endif // defined(VIDEO_HOLE) | 647 #endif // defined(VIDEO_HOLE) |
661 } | 648 } |
662 | 649 |
663 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { | 650 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { |
664 player->Release(); | 651 player->Release(); |
665 ReleaseMediaResources(player->player_id()); | 652 ReleaseMediaResources(player->player_id()); |
666 } | 653 } |
667 | 654 |
668 } // namespace content | 655 } // namespace content |
OLD | NEW |