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

Unified Diff: content/public/browser/media_session.h

Issue 2623953002: [Chromecast] Fix media session blocking tests. (Closed)
Patch Set: Move MockMediaSession into chromecast/ only Created 3 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/public/browser/media_session.h
diff --git a/content/public/browser/media_session.h b/content/public/browser/media_session.h
index 509629f894ad72b8111d6e5a418046463e6d8c5b..f0b10a0a343d62c62acb0df7c521da3212bfaf50 100644
--- a/content/public/browser/media_session.h
+++ b/content/public/browser/media_session.h
@@ -6,6 +6,7 @@
#define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
#include "base/macros.h"
+#include "base/observer_list.h"
#include "content/common/content_export.h"
namespace blink {
@@ -16,6 +17,7 @@ enum class MediaSessionAction;
namespace content {
+class MediaSessionObserver;
class WebContents;
// MediaSession manages the media session and audio focus for a given
@@ -23,7 +25,7 @@ class WebContents;
//
// MediaSession allows clients to observe its changes via MediaSessionObserver,
// and allows clients to resume/suspend/stop the managed players.
-class MediaSession {
+class CONTENT_EXPORT MediaSession {
Zhiqiang Zhang (Slow) 2017/01/30 12:09:11 Revert this change as MediaSession is back to a pu
derekjchow1 2017/02/01 01:22:19 Done.
public:
enum class SuspendType {
// Suspended by the system because a transient sound needs to be played.
@@ -38,7 +40,7 @@ class MediaSession {
// none is currently available.
CONTENT_EXPORT static MediaSession* Get(WebContents* contents);
- virtual ~MediaSession() = default;
+ virtual ~MediaSession();
Zhiqiang Zhang (Slow) 2017/01/30 12:09:10 Revert this change as MediaSession is back to a pu
derekjchow1 2017/02/01 01:22:18 Done.
// Resume the media session.
// |type| represents the origin of the request.
@@ -64,7 +66,17 @@ class MediaSession {
virtual void StopDucking() = 0;
protected:
- MediaSession() = default;
+ MediaSession();
Zhiqiang Zhang (Slow) 2017/01/30 12:09:11 Revert this change as MediaSession is back to a pu
derekjchow1 2017/02/01 01:22:18 Done.
+
+ base::ObserverList<MediaSessionObserver>& observers() { return observers_; }
mlamouri (slow - plz ping) 2017/01/28 02:01:40 Can you move the implementation to the .cc file?
Zhiqiang Zhang (Slow) 2017/01/30 12:09:10 I think you don't need this any more. Revert this
derekjchow1 2017/02/01 01:22:18 Removed (only in MediaSessionImpl now).
derekjchow1 2017/02/01 01:22:19 Done.
+
+ private:
+ friend class MediaSessionObserver;
+
+ void AddObserver(MediaSessionObserver* observer);
Zhiqiang Zhang (Slow) 2017/01/30 12:09:10 Make it pure-virtual. Keep it as private should be
derekjchow1 2017/02/01 01:22:19 Done.
+ void RemoveObserver(MediaSessionObserver* observer);
Zhiqiang Zhang (Slow) 2017/01/30 12:09:10 ditto
derekjchow1 2017/02/01 01:22:18 Done.
+
+ base::ObserverList<MediaSessionObserver> observers_;
Zhiqiang Zhang (Slow) 2017/01/30 12:09:10 ditto (same reason as `observers()`)
derekjchow1 2017/02/01 01:22:18 Done.
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698