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

Unified Diff: content/browser/media/android/media_web_contents_observer_android.cc

Issue 2380743004: media: Remove Browser CDM implementation (Closed)
Patch Set: media: Remove Browser CDM implementation Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/android/media_web_contents_observer_android.cc
diff --git a/content/browser/media/android/media_web_contents_observer_android.cc b/content/browser/media/android/media_web_contents_observer_android.cc
index af973d4731b1becd1ad19f5598b883f47dcf7a54..2e585b184753f6c2ccbbebb4ed7fb1e961e9b243 100644
--- a/content/browser/media/android/media_web_contents_observer_android.cc
+++ b/content/browser/media/android/media_web_contents_observer_android.cc
@@ -10,7 +10,6 @@
#include "content/browser/media/android/browser_media_player_manager.h"
#include "content/browser/media/android/browser_media_session_manager.h"
#include "content/browser/media/android/browser_surface_view_manager.h"
-#include "content/browser/media/cdm/browser_cdm_manager.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/media/media_player_delegate_messages.h"
#include "content/common/media/media_player_messages_android.h"
@@ -115,21 +114,9 @@ void MediaWebContentsObserverAndroid::RenderFrameDeleted(
RenderFrameHost* render_frame_host) {
MediaWebContentsObserver::RenderFrameDeleted(render_frame_host);
- // Always destroy the media players before CDMs because we do not support
- // detaching CDMs from media players yet. See http://crbug.com/330324
media_player_managers_.erase(render_frame_host);
media_session_managers_.erase(render_frame_host);
surface_view_managers_.erase(render_frame_host);
-
- // TODO(xhwang): Currently MediaWebContentsObserver, BrowserMediaPlayerManager
- // and BrowserCdmManager all run on browser UI thread. So this call is okay.
- // In the future we need to support the case where MediaWebContentsObserver
- // get notified on browser UI thread, but BrowserMediaPlayerManager and
- // BrowserCdmManager run on a different thread.
- BrowserCdmManager* browser_cdm_manager =
- BrowserCdmManager::FromProcess(render_frame_host->GetProcess()->GetID());
- if (browser_cdm_manager)
- browser_cdm_manager->RenderFrameDeleted(render_frame_host->GetRoutingID());
}
bool MediaWebContentsObserverAndroid::OnMessageReceived(
@@ -141,9 +128,6 @@ bool MediaWebContentsObserverAndroid::OnMessageReceived(
if (OnMediaPlayerMessageReceived(msg, render_frame_host))
return true;
- if (OnMediaPlayerSetCdmMessageReceived(msg, render_frame_host))
- return true;
-
if (OnMediaSessionMessageReceived(msg, render_frame_host))
return true;
@@ -197,18 +181,6 @@ bool MediaWebContentsObserverAndroid::OnMediaPlayerMessageReceived(
return handled;
}
-bool MediaWebContentsObserverAndroid::OnMediaPlayerSetCdmMessageReceived(
- const IPC::Message& msg,
- RenderFrameHost* render_frame_host) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(MediaWebContentsObserverAndroid, msg,
- render_frame_host)
- IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetCdm, OnSetCdm)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
bool MediaWebContentsObserverAndroid::OnMediaSessionMessageReceived(
const IPC::Message& msg,
RenderFrameHost* render_frame_host) {
@@ -246,35 +218,4 @@ bool MediaWebContentsObserverAndroid::OnSurfaceViewManagerMessageReceived(
return handled;
}
-void MediaWebContentsObserverAndroid::OnSetCdm(
- RenderFrameHost* render_frame_host,
- int player_id,
- int cdm_id) {
- media::MediaPlayerAndroid* media_player =
- GetMediaPlayerManager(render_frame_host)->GetPlayer(player_id);
- if (!media_player) {
- NOTREACHED() << "OnSetCdm: MediaPlayer not found for " << player_id;
- return;
- }
-
- // MediaPlayerAndroid runs on the same thread as BrowserCdmManager.
- BrowserCdmManager* browser_cdm_manager =
- BrowserCdmManager::FromProcess(render_frame_host->GetProcess()->GetID());
- if (!browser_cdm_manager) {
- NOTREACHED() << "OnSetCdm: CDM not found for " << cdm_id;
- return;
- }
-
- scoped_refptr<media::MediaKeys> cdm =
- browser_cdm_manager->GetCdm(render_frame_host->GetRoutingID(), cdm_id);
- if (!cdm) {
- NOTREACHED() << "OnSetCdm: CDM not found for " << cdm_id;
- return;
- }
-
- // TODO(xhwang): This could possibly fail. In that case we should reject the
- // promise.
- media_player->SetCdm(cdm);
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698