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

Side by Side Diff: content/public/browser/media_session_observer.h

Issue 2479603003: Revert of Adding new media controls to MediaNotification (Closed)
Patch Set: Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_
6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ 6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/public/common/media_metadata.h" 11 #include "content/public/common/media_metadata.h"
12 12
13 namespace blink {
14 namespace mojom {
15 enum class MediaSessionAction;
16 } // namespace mojom
17 } // namespace blink
18
19 namespace content { 13 namespace content {
20 14
21 class MediaSession; 15 class MediaSession;
22 class MediaSessionImpl; 16 class MediaSessionImpl;
23 17
24 // The observer for observing MediaSession events. 18 // The observer for observing MediaSession events.
25 class CONTENT_EXPORT MediaSessionObserver { 19 class CONTENT_EXPORT MediaSessionObserver {
26 public: 20 public:
27 // Gets the observed MediaSession. Will return null when the session is 21 // Gets the observed MediaSession. Will return null when the session is
28 // destroyed. 22 // destroyed.
29 MediaSession* media_session() const; 23 MediaSession* media_session() const;
30 24
31 // Called when the observed MediaSession is being destroyed. Give subclass a 25 // Called when the observed MediaSession is being destroyed. Give subclass a
32 // chance to clean up. media_session() will return nullptr after this method 26 // chance to clean up. media_session() will return nullptr after this method
33 // is called. 27 // is called.
34 virtual void MediaSessionDestroyed() {} 28 virtual void MediaSessionDestroyed() {}
35 29
36 // Called when the observed MediaSession has changed its state. 30 // Called when the observed MediaSession has changed its state.
37 virtual void MediaSessionStateChanged(bool is_controllable, 31 virtual void MediaSessionStateChanged(bool is_controllable,
38 bool is_suspended) {} 32 bool is_suspended) {}
39 33
40 // Called when the observed MediaSession has changed metadata. 34 // Called when the observed MediaSession has changed metadata.
41 virtual void MediaSessionMetadataChanged( 35 virtual void MediaSessionMetadataChanged(
42 const base::Optional<MediaMetadata>& metadata) {} 36 const base::Optional<MediaMetadata>& metadata) {}
43 37
44 // Called when media session action is enabled.
45 virtual void MediaSessionEnabledAction(
46 blink::mojom::MediaSessionAction action) {}
47
48 // Called when media session action is disabled.
49 virtual void MediaSessionDisabledAction(
50 blink::mojom::MediaSessionAction action) {}
51
52 protected: 38 protected:
53 // Create a MediaSessionObserver and start observing a session. 39 // Create a MediaSessionObserver and start observing a session.
54 MediaSessionObserver(MediaSession* media_session); 40 MediaSessionObserver(MediaSession* media_session);
55 // Destruct a MediaSessionObserver and remove it from the session if it's 41 // Destruct a MediaSessionObserver and remove it from the session if it's
56 // still observing. 42 // still observing.
57 virtual ~MediaSessionObserver(); 43 virtual ~MediaSessionObserver();
58 44
59 private: 45 private:
60 friend class MediaSessionImpl; 46 friend class MediaSessionImpl;
61 47
62 void StopObserving(); 48 void StopObserving();
63 49
64 // Weak pointer to MediaSession 50 // Weak pointer to MediaSession
65 MediaSessionImpl* media_session_; 51 MediaSessionImpl* media_session_;
66 52
67 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver); 53 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver);
68 }; 54 };
69 55
70 } // namespace content 56 } // namespace content
71 57
72 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ 58 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/public/browser/media_session.h ('k') | third_party/WebKit/Source/modules/mediasession/MediaSession.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698