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

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

Issue 1570043002: Implement MediaSession on top of the WebMediaPlayerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session
Patch Set: Created 4 years, 11 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/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 0591e25b73eaf5dcb8d5d1b5377f9708a6a38f77..562836ebc33dc4146289b094915afe17c857084d 100644
--- a/content/browser/media/media_web_contents_observer.cc
+++ b/content/browser/media/media_web_contents_observer.cc
@@ -41,6 +41,8 @@ bool MediaWebContentsObserver::OnMessageReceived(
// TODO(dalecurtis): These should no longer be FrameHostMsg.
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(MediaWebContentsObserver, msg,
render_frame_host)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_MediaDestroyedNotification,
+ OnMediaDestroyedNotification)
IPC_MESSAGE_HANDLER(FrameHostMsg_MediaPlayingNotification,
OnMediaPlayingNotification)
IPC_MESSAGE_HANDLER(FrameHostMsg_MediaPausedNotification,
@@ -50,12 +52,19 @@ bool MediaWebContentsObserver::OnMessageReceived(
return handled;
}
+void MediaWebContentsObserver::OnMediaDestroyedNotification(
+ RenderFrameHost* render_frame_host,
+ int64_t player_cookie) {
+ OnMediaPausedNotification(render_frame_host, player_cookie, true);
+}
+
void MediaWebContentsObserver::OnMediaPlayingNotification(
RenderFrameHost* render_frame_host,
int64_t player_cookie,
bool has_video,
bool has_audio,
- bool is_remote) {
+ bool is_remote,
+ base::TimeDelta duration) {
// Ignore the videos playing remotely and don't hold the wake lock for the
// screen. TODO(dalecurtis): Is this correct? It means observers will not
// receive play and pause messages.
@@ -91,7 +100,8 @@ void MediaWebContentsObserver::OnMediaPlayingNotification(
void MediaWebContentsObserver::OnMediaPausedNotification(
RenderFrameHost* render_frame_host,
- int64_t player_cookie) {
+ int64_t player_cookie,
+ bool reached_end_of_stream) {
const MediaPlayerId id(render_frame_host, player_cookie);
const bool removed_audio = RemoveMediaPlayerEntry(id, &active_audio_players_);
const bool removed_video = RemoveMediaPlayerEntry(id, &active_video_players_);

Powered by Google App Engine
This is Rietveld 408576698