Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/browser/android/content_view_core_impl.h" | 8 #include "content/browser/android/content_view_core_impl.h" |
| 9 #include "content/browser/media/android/browser_demuxer_android.h" | 9 #include "content/browser/media/android/browser_demuxer_android.h" |
| 10 #include "content/browser/media/android/media_resource_getter_impl.h" | 10 #include "content/browser/media/android/media_resource_getter_impl.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 bool BrowserMediaPlayerManager::OnMessageReceived(const IPC::Message& msg) { | 125 bool BrowserMediaPlayerManager::OnMessageReceived(const IPC::Message& msg) { |
| 126 bool handled = true; | 126 bool handled = true; |
| 127 IPC_BEGIN_MESSAGE_MAP(BrowserMediaPlayerManager, msg) | 127 IPC_BEGIN_MESSAGE_MAP(BrowserMediaPlayerManager, msg) |
| 128 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_EnterFullscreen, OnEnterFullscreen) | 128 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_EnterFullscreen, OnEnterFullscreen) |
| 129 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_ExitFullscreen, OnExitFullscreen) | 129 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_ExitFullscreen, OnExitFullscreen) |
| 130 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Initialize, OnInitialize) | 130 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Initialize, OnInitialize) |
| 131 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Start, OnStart) | 131 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Start, OnStart) |
| 132 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Seek, OnSeek) | 132 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Seek, OnSeek) |
| 133 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Pause, OnPause) | 133 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Pause, OnPause) |
| 134 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetVolume, OnSetVolume) | 134 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetVolume, OnSetVolume) |
| 135 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetPoster, OnSetPoster) | |
| 135 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Release, OnReleaseResources) | 136 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Release, OnReleaseResources) |
| 136 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer) | 137 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer) |
| 137 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, | 138 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, |
| 138 DestroyAllMediaPlayers) | 139 DestroyAllMediaPlayers) |
| 139 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_InitializeCDM, | 140 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_InitializeCDM, |
| 140 OnInitializeCDM) | 141 OnInitializeCDM) |
| 141 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession) | 142 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession) |
| 142 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession) | 143 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession) |
| 143 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession) | 144 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession) |
| 144 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CancelAllPendingSessionCreations, | 145 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CancelAllPendingSessionCreations, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 if (player) | 561 if (player) |
| 561 player->Pause(is_media_related_action); | 562 player->Pause(is_media_related_action); |
| 562 } | 563 } |
| 563 | 564 |
| 564 void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) { | 565 void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) { |
| 565 MediaPlayerAndroid* player = GetPlayer(player_id); | 566 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 566 if (player) | 567 if (player) |
| 567 player->SetVolume(volume); | 568 player->SetVolume(volume); |
| 568 } | 569 } |
| 569 | 570 |
| 571 void BrowserMediaPlayerManager::OnSetPoster(int player_id, const GURL& url) { | |
| 572 // To be overridden by subclasses. | |
|
palmer
2014/02/13 21:52:27
Do any such subclasses exist now?
Does it make se
acolwell GONE FROM CHROMIUM
2014/02/13 22:17:03
Yes. In the internal Android UI codebase.
| |
| 573 } | |
| 574 | |
| 570 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { | 575 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { |
| 571 MediaPlayerAndroid* player = GetPlayer(player_id); | 576 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 572 if (player) | 577 if (player) |
| 573 player->Release(); | 578 player->Release(); |
| 574 | 579 |
| 575 #if defined(VIDEO_HOLE) | 580 #if defined(VIDEO_HOLE) |
| 576 WebContentsViewAndroid* view = | 581 WebContentsViewAndroid* view = |
| 577 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); | 582 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); |
| 578 if (view) | 583 if (view) |
| 579 view->NotifyExternalSurface(player_id, false, gfx::RectF()); | 584 view->NotifyExternalSurface(player_id, false, gfx::RectF()); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 if (pending_fullscreen_player_id_ != media_keys_id) | 850 if (pending_fullscreen_player_id_ != media_keys_id) |
| 846 return; | 851 return; |
| 847 | 852 |
| 848 pending_fullscreen_player_id_ = -1; | 853 pending_fullscreen_player_id_ = -1; |
| 849 MediaPlayerAndroid* player = GetPlayer(media_keys_id); | 854 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
| 850 if (player->IsPlaying()) | 855 if (player->IsPlaying()) |
| 851 OnProtectedSurfaceRequested(media_keys_id); | 856 OnProtectedSurfaceRequested(media_keys_id); |
| 852 } | 857 } |
| 853 | 858 |
| 854 } // namespace content | 859 } // namespace content |
| OLD | NEW |