OLD | NEW |
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/callback_list.h" | 10 #include "base/callback_list.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Suspended by the page via script or user interaction. | 55 // Suspended by the page via script or user interaction. |
56 CONTENT, | 56 CONTENT, |
57 }; | 57 }; |
58 | 58 |
59 // Returns the MediaSession associated to this WebContents. Creates one if | 59 // Returns the MediaSession associated to this WebContents. Creates one if |
60 // none is currently available. | 60 // none is currently available. |
61 CONTENT_EXPORT static MediaSession* Get(WebContents* web_contents); | 61 CONTENT_EXPORT static MediaSession* Get(WebContents* web_contents); |
62 | 62 |
63 ~MediaSession() override; | 63 ~MediaSession() override; |
64 | 64 |
65 void setMetadata(const MediaMetadata& metadata) { | 65 void SetMetadata(const MediaMetadata& metadata); |
66 metadata_ = metadata; | |
67 } | |
68 const MediaMetadata& metadata() const { return metadata_; } | 66 const MediaMetadata& metadata() const { return metadata_; } |
69 | 67 |
70 // Adds the given player to the current media session. Returns whether the | 68 // Adds the given player to the current media session. Returns whether the |
71 // player was successfully added. If it returns false, AddPlayer() should be | 69 // player was successfully added. If it returns false, AddPlayer() should be |
72 // called again later. | 70 // called again later. |
73 CONTENT_EXPORT bool AddPlayer(MediaSessionObserver* observer, | 71 CONTENT_EXPORT bool AddPlayer(MediaSessionObserver* observer, |
74 int player_id, Type type); | 72 int player_id, Type type); |
75 | 73 |
76 // Removes the given player from the current media session. Abandons audio | 74 // Removes the given player from the current media session. Abandons audio |
77 // focus if that was the last player in the session. | 75 // focus if that was the last player in the session. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 201 |
204 MediaMetadata metadata_; | 202 MediaMetadata metadata_; |
205 base::CallbackList<void(State)> media_session_state_listeners_; | 203 base::CallbackList<void(State)> media_session_state_listeners_; |
206 | 204 |
207 DISALLOW_COPY_AND_ASSIGN(MediaSession); | 205 DISALLOW_COPY_AND_ASSIGN(MediaSession); |
208 }; | 206 }; |
209 | 207 |
210 } // namespace content | 208 } // namespace content |
211 | 209 |
212 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ | 210 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ |
OLD | NEW |