OLD | NEW |
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 <set> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/optional.h" | 11 #include "base/optional.h" |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
11 #include "content/public/common/media_metadata.h" | 13 #include "content/public/common/media_metadata.h" |
12 | 14 |
13 namespace blink { | 15 namespace blink { |
14 namespace mojom { | 16 namespace mojom { |
15 enum class MediaSessionAction; | 17 enum class MediaSessionAction; |
16 } // namespace mojom | 18 } // namespace mojom |
17 } // namespace blink | 19 } // namespace blink |
(...skipping 16 matching lines...) Expand all Loading... |
34 virtual void MediaSessionDestroyed() {} | 36 virtual void MediaSessionDestroyed() {} |
35 | 37 |
36 // Called when the observed MediaSession has changed its state. | 38 // Called when the observed MediaSession has changed its state. |
37 virtual void MediaSessionStateChanged(bool is_controllable, | 39 virtual void MediaSessionStateChanged(bool is_controllable, |
38 bool is_suspended) {} | 40 bool is_suspended) {} |
39 | 41 |
40 // Called when the observed MediaSession has changed metadata. | 42 // Called when the observed MediaSession has changed metadata. |
41 virtual void MediaSessionMetadataChanged( | 43 virtual void MediaSessionMetadataChanged( |
42 const base::Optional<MediaMetadata>& metadata) {} | 44 const base::Optional<MediaMetadata>& metadata) {} |
43 | 45 |
44 // Called when media session action is enabled. | 46 // Called when the media session action list has changed. |
45 virtual void MediaSessionEnabledAction( | 47 virtual void MediaSessionActionsChanged( |
46 blink::mojom::MediaSessionAction action) {} | 48 const std::set<blink::mojom::MediaSessionAction>& action) {} |
47 | |
48 // Called when media session action is disabled. | |
49 virtual void MediaSessionDisabledAction( | |
50 blink::mojom::MediaSessionAction action) {} | |
51 | 49 |
52 protected: | 50 protected: |
53 // Create a MediaSessionObserver and start observing a session. | 51 // Create a MediaSessionObserver and start observing a session. |
54 MediaSessionObserver(MediaSession* media_session); | 52 MediaSessionObserver(MediaSession* media_session); |
55 // Destruct a MediaSessionObserver and remove it from the session if it's | 53 // Destruct a MediaSessionObserver and remove it from the session if it's |
56 // still observing. | 54 // still observing. |
57 virtual ~MediaSessionObserver(); | 55 virtual ~MediaSessionObserver(); |
58 | 56 |
59 private: | 57 private: |
60 friend class MediaSessionImpl; | 58 friend class MediaSessionImpl; |
61 | 59 |
62 void StopObserving(); | 60 void StopObserving(); |
63 | 61 |
64 // Weak pointer to MediaSession | 62 // Weak pointer to MediaSession |
65 MediaSessionImpl* media_session_; | 63 MediaSessionImpl* media_session_; |
66 | 64 |
67 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver); | 65 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver); |
68 }; | 66 }; |
69 | 67 |
70 } // namespace content | 68 } // namespace content |
71 | 69 |
72 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ | 70 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ |
OLD | NEW |