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

Side by Side Diff: content/browser/media/session/media_session.h

Issue 1458703003: Media Session API: use MediaMetadata in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session_browser_side
Patch Set: nits Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/id_map.h" 10 #include "base/id_map.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "content/browser/media/session/media_session_uma_helper.h" 12 #include "content/browser/media/session/media_session_uma_helper.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/browser/web_contents_user_data.h" 15 #include "content/public/browser/web_contents_user_data.h"
16 #include "content/public/common/media_metadata.h"
16 17
17 class MediaSessionBrowserTest; 18 class MediaSessionBrowserTest;
18 19
19 namespace content { 20 namespace content {
20 21
21 class MediaSessionDelegate; 22 class MediaSessionDelegate;
22 class MediaSessionObserver; 23 class MediaSessionObserver;
23 24
24 // MediaSession manages the media session and audio focus for a given 25 // MediaSession manages the media session and audio focus for a given
25 // WebContents. It is requesting the audio focus, pausing when requested by the 26 // WebContents. It is requesting the audio focus, pausing when requested by the
(...skipping 25 matching lines...) Expand all
51 // Suspended by the page via script or user interaction. 52 // Suspended by the page via script or user interaction.
52 CONTENT, 53 CONTENT,
53 }; 54 };
54 55
55 // Returns the MediaSession associated to this WebContents. Creates one if 56 // Returns the MediaSession associated to this WebContents. Creates one if
56 // none is currently available. 57 // none is currently available.
57 CONTENT_EXPORT static MediaSession* Get(WebContents* web_contents); 58 CONTENT_EXPORT static MediaSession* Get(WebContents* web_contents);
58 59
59 ~MediaSession() override; 60 ~MediaSession() override;
60 61
62 void setMetadata(const MediaMetadata& metadata) {
63 metadata_ = metadata;
64 }
65 const MediaMetadata& metadata() const { return metadata_; }
66
61 // Adds the given player to the current media session. Returns whether the 67 // Adds the given player to the current media session. Returns whether the
62 // player was successfully added. If it returns false, AddPlayer() should be 68 // player was successfully added. If it returns false, AddPlayer() should be
63 // called again later. 69 // called again later.
64 CONTENT_EXPORT bool AddPlayer(MediaSessionObserver* observer, 70 CONTENT_EXPORT bool AddPlayer(MediaSessionObserver* observer,
65 int player_id, Type type); 71 int player_id, Type type);
66 72
67 // Removes the given player from the current media session. Abandons audio 73 // Removes the given player from the current media session. Abandons audio
68 // focus if that was the last player in the session. 74 // focus if that was the last player in the session.
69 CONTENT_EXPORT void RemovePlayer(MediaSessionObserver* observer, 75 CONTENT_EXPORT void RemovePlayer(MediaSessionObserver* observer,
70 int player_id); 76 int player_id);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 State audio_focus_state_; 183 State audio_focus_state_;
178 SuspendType suspend_type_; 184 SuspendType suspend_type_;
179 Type audio_focus_type_; 185 Type audio_focus_type_;
180 186
181 MediaSessionUmaHelper uma_helper_; 187 MediaSessionUmaHelper uma_helper_;
182 188
183 // The volume multiplier of this session. All players in this session should 189 // The volume multiplier of this session. All players in this session should
184 // multiply their volume with this multiplier to get the effective volume. 190 // multiply their volume with this multiplier to get the effective volume.
185 double volume_multiplier_; 191 double volume_multiplier_;
186 192
193 MediaMetadata metadata_;
194
187 DISALLOW_COPY_AND_ASSIGN(MediaSession); 195 DISALLOW_COPY_AND_ASSIGN(MediaSession);
188 }; 196 };
189 197
190 } // namespace content 198 } // namespace content
191 199
192 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ 200 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_
OLDNEW
« no previous file with comments | « content/browser/android/web_contents_observer_proxy.cc ('k') | content/browser/media/session/media_session_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698