| 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_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ | 6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 namespace mojom { | 12 namespace mojom { |
| 13 enum class MediaSessionAction; | 13 enum class MediaSessionAction; |
| 14 } // namespace mojom | 14 } // namespace mojom |
| 15 } // namespace blink | 15 } // namespace blink |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class MediaSessionObserver; |
| 19 class WebContents; | 20 class WebContents; |
| 20 | 21 |
| 21 // MediaSession manages the media session and audio focus for a given | 22 // MediaSession manages the media session and audio focus for a given |
| 22 // WebContents. There is only one MediaSession per WebContents. | 23 // WebContents. There is only one MediaSession per WebContents. |
| 23 // | 24 // |
| 24 // MediaSession allows clients to observe its changes via MediaSessionObserver, | 25 // MediaSession allows clients to observe its changes via MediaSessionObserver, |
| 25 // and allows clients to resume/suspend/stop the managed players. | 26 // and allows clients to resume/suspend/stop the managed players. |
| 26 class MediaSession { | 27 class MediaSession { |
| 27 public: | 28 public: |
| 28 enum class SuspendType { | 29 enum class SuspendType { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 // Let the media session start ducking such that the volume multiplier is | 59 // Let the media session start ducking such that the volume multiplier is |
| 59 // reduced. | 60 // reduced. |
| 60 virtual void StartDucking() = 0; | 61 virtual void StartDucking() = 0; |
| 61 | 62 |
| 62 // Let the media session stop ducking such that the volume multiplier is | 63 // Let the media session stop ducking such that the volume multiplier is |
| 63 // recovered. | 64 // recovered. |
| 64 virtual void StopDucking() = 0; | 65 virtual void StopDucking() = 0; |
| 65 | 66 |
| 66 protected: | 67 protected: |
| 67 MediaSession() = default; | 68 MediaSession() = default; |
| 69 |
| 70 private: |
| 71 friend class MediaSessionObserver; |
| 72 |
| 73 virtual void AddObserver(MediaSessionObserver* observer) = 0; |
| 74 virtual void RemoveObserver(MediaSessionObserver* observer) = 0; |
| 68 }; | 75 }; |
| 69 | 76 |
| 70 } // namespace content | 77 } // namespace content |
| 71 | 78 |
| 72 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ | 79 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ |
| OLD | NEW |