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

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

Issue 107413006: Dismiss EME infobar when WebMediaPlayer is destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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/browser_media_player_manager.cc
diff --git a/content/browser/media/android/browser_media_player_manager.cc b/content/browser/media/android/browser_media_player_manager.cc
index 43b93da7fc32d6c9e378c494eb07b1ae6bd99e2b..c9c725a3b47049814829b04081261ad4e6a84297 100644
--- a/content/browser/media/android/browser_media_player_manager.cc
+++ b/content/browser/media/android/browser_media_player_manager.cc
@@ -134,6 +134,7 @@ bool BrowserMediaPlayerManager::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession)
IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession)
IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession)
+ IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CancelSession, OnCancelSession)
#if defined(VIDEO_HOLE)
IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface,
OnNotifyExternalSurface)
@@ -601,8 +602,14 @@ void BrowserMediaPlayerManager::OnCreateSession(
media_keys_ids_approved_.end()) {
media_keys_ids_pending_approval_.insert(media_keys_id);
}
- web_contents()->GetDelegate()->RequestProtectedMediaIdentifierPermission(
- web_contents(),
+
+ BrowserContext* context =
+ web_contents()->GetRenderProcessHost()->GetBrowserContext();
+
+ context->RequestProtectedMediaIdentifierPermission(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetRenderViewHost()->GetRoutingID(),
+ session_id,
drm_bridge->frame_url(),
base::Bind(&BrowserMediaPlayerManager::GenerateKeyIfAllowed,
weak_ptr_factory_.GetWeakPtr(),
@@ -654,6 +661,26 @@ void BrowserMediaPlayerManager::OnReleaseSession(int media_keys_id,
drm_bridge->ReleaseSession(session_id);
}
+void BrowserMediaPlayerManager::OnCancelSession(int media_keys_id,
+ uint32 session_id) {
+ MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id);
+ if (!drm_bridge) {
+ DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found";
+ OnSessionError(
+ media_keys_id, session_id, media::MediaKeys::kUnknownError, 0);
+ return;
+ }
+
+ BrowserContext* context =
+ web_contents()->GetRenderProcessHost()->GetBrowserContext();
+
+ context->CancelProtectedMediaIdentifierPermissionRequest(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetRenderViewHost()->GetRoutingID(),
+ static_cast<int>(session_id),
+ drm_bridge->frame_url());
+}
+
void BrowserMediaPlayerManager::AddPlayer(MediaPlayerAndroid* player) {
DCHECK(!GetPlayer(player->player_id()));
players_.push_back(player);
@@ -752,6 +779,9 @@ void BrowserMediaPlayerManager::GenerateKeyIfAllowed(
const std::string& type,
const std::vector<uint8>& init_data,
bool allowed) {
+ Send(new MediaKeysMsg_SessionApproved(
+ routing_id(), media_keys_id, session_id, allowed));
+
if (!allowed)
return;
ddorwin 2013/12/20 23:59:52 I'm surprised we don't already fire some event her
xhwang 2013/12/21 00:40:48 Yeah, we should call OnSessionError() before we re
Kibeom Kim (inactive) 2013/12/30 12:33:05 Done.

Powered by Google App Engine
This is Rietveld 408576698