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 web_contents_->DownloadImage( | |
| 573 url, | |
| 574 false /* is_favicon, false so that cookies will be used. */, | |
|
whywhat
2014/02/04 15:58:01
nit: change to
false, // comment here, two space
| |
| 575 0 /* max_bitmap_size */, | |
|
whywhat
2014/02/04 15:58:01
ditto
| |
| 576 base::Bind(&BrowserMediaPlayerManager::DidDownloadPoster,base::Unretained( this))); | |
|
whywhat
2014/02/04 15:58:01
nit: 80 chars
| |
| 577 } | |
| 578 | |
| 579 // Callback for when the download of poster image is done. | |
| 580 void BrowserMediaPlayerManager::DidDownloadPoster( | |
| 581 int id, | |
| 582 int http_status_code, | |
| 583 const GURL& image_url, | |
| 584 const std::vector<SkBitmap>& bitmaps, | |
| 585 const std::vector<gfx::Size>& original_bitmap_sizes) { | |
| 586 // To be overriden. | |
|
whywhat
2014/02/04 15:58:01
What does this comment mean?
| |
| 587 } | |
|
acolwell GONE FROM CHROMIUM
2014/02/04 20:00:21
Why isn't there any code that does anything with t
cimamoglu (inactive)
2014/02/07 14:47:26
Done. The other CL: https://chrome-internal-review
| |
| 588 | |
| 570 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { | 589 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { |
| 571 MediaPlayerAndroid* player = GetPlayer(player_id); | 590 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 572 if (player) | 591 if (player) |
| 573 player->Release(); | 592 player->Release(); |
| 574 | 593 |
| 575 #if defined(VIDEO_HOLE) | 594 #if defined(VIDEO_HOLE) |
| 576 WebContentsViewAndroid* view = | 595 WebContentsViewAndroid* view = |
| 577 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); | 596 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); |
| 578 if (view) | 597 if (view) |
| 579 view->NotifyExternalSurface(player_id, false, gfx::RectF()); | 598 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) | 864 if (pending_fullscreen_player_id_ != media_keys_id) |
| 846 return; | 865 return; |
| 847 | 866 |
| 848 pending_fullscreen_player_id_ = -1; | 867 pending_fullscreen_player_id_ = -1; |
| 849 MediaPlayerAndroid* player = GetPlayer(media_keys_id); | 868 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
| 850 if (player->IsPlaying()) | 869 if (player->IsPlaying()) |
| 851 OnProtectedSurfaceRequested(media_keys_id); | 870 OnProtectedSurfaceRequested(media_keys_id); |
| 852 } | 871 } |
| 853 | 872 |
| 854 } // namespace content | 873 } // namespace content |
| OLD | NEW |