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

Unified Diff: content/browser/media/media_web_contents_observer.cc

Issue 1441883003: Hook up RendererMediaSessionManager with browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « content/browser/media/media_web_contents_observer.h ('k') | content/common/content_message_generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/media_web_contents_observer.cc
diff --git a/content/browser/media/media_web_contents_observer.cc b/content/browser/media/media_web_contents_observer.cc
index dc79efa14bbb9145f213da0fb9eeb4d2ec813e71..42dcf93134843b4f484f4f7ee74ca9106816fe57 100644
--- a/content/browser/media/media_web_contents_observer.cc
+++ b/content/browser/media/media_web_contents_observer.cc
@@ -16,7 +16,9 @@
#if defined(OS_ANDROID)
#include "content/browser/media/android/browser_media_player_manager.h"
+#include "content/browser/media/android/browser_media_session_manager.h"
#include "content/common/media/media_player_messages_android.h"
+#include "content/common/media/media_session_messages_android.h"
#include "media/base/android/media_player_android.h"
#endif // defined(OS_ANDROID)
@@ -35,6 +37,7 @@ void MediaWebContentsObserver::RenderFrameDeleted(
// 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);
// TODO(xhwang): Currently MediaWebContentsObserver, BrowserMediaPlayerManager
// and BrowserCdmManager all run on browser UI thread. So this call is okay.
@@ -295,6 +298,12 @@ bool MediaWebContentsObserver::OnMediaPlayerMessageReceived(
GetMediaPlayerManager(render_frame_host),
BrowserMediaPlayerManager::OnNotifyExternalSurface)
#endif // defined(VIDEO_HOLE)
+ IPC_MESSAGE_FORWARD(MediaSessionHostMsg_Activate,
+ GetMediaSessionManager(render_frame_host),
+ BrowserMediaSessionManager::OnActivate)
+ IPC_MESSAGE_FORWARD(MediaSessionHostMsg_Deactivate,
+ GetMediaSessionManager(render_frame_host),
+ BrowserMediaSessionManager::OnDeactivate)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -354,6 +363,18 @@ BrowserMediaPlayerManager* MediaWebContentsObserver::GetMediaPlayerManager(
return manager;
}
+BrowserMediaSessionManager* MediaWebContentsObserver::GetMediaSessionManager(
+ RenderFrameHost* render_frame_host) {
+ auto it = media_session_managers_.find(render_frame_host);
+ if (it != media_session_managers_.end())
+ return it->second;
+
+ BrowserMediaSessionManager* manager =
+ new BrowserMediaSessionManager(render_frame_host);
+ media_session_managers_.set(render_frame_host, make_scoped_ptr(manager));
+ return manager;
+}
+
#if defined(VIDEO_HOLE)
void MediaWebContentsObserver::OnFrameInfoUpdated() {
for (auto it = media_player_managers_.begin();
« no previous file with comments | « content/browser/media/media_web_contents_observer.h ('k') | content/common/content_message_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698