| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "content/common/content_export.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 class WebContents; |
| 14 |
| 15 // MediaSession manages the media session and audio focus for a given |
| 16 // WebContents. There is only one MediaSession per WebContents. |
| 17 // |
| 18 // MediaSession allows clients to observe its changes via MediaSessionObserver, |
| 19 // and allows clients to resume/suspend/stop the managed players. |
| 20 class MediaSession { |
| 21 public: |
| 22 enum class SuspendType { |
| 23 // Suspended by the system because a transient sound needs to be played. |
| 24 SYSTEM, |
| 25 // Suspended by the UI. |
| 26 UI, |
| 27 // Suspended by the page via script or user interaction. |
| 28 CONTENT, |
| 29 }; |
| 30 |
| 31 // Returns the MediaSession associated to this WebContents. Creates one if |
| 32 // none is currently available. |
| 33 CONTENT_EXPORT static MediaSession* Get(WebContents* contents); |
| 34 |
| 35 virtual ~MediaSession() = default; |
| 36 |
| 37 // Resume the media session. |
| 38 // |type| represents the origin of the request. |
| 39 virtual void Resume(SuspendType suspend_type) = 0; |
| 40 |
| 41 // Resume the media session. |
| 42 // |type| represents the origin of the request. |
| 43 virtual void Suspend(SuspendType suspend_type) = 0; |
| 44 |
| 45 // Resume the media session. |
| 46 // |type| represents the origin of the request. |
| 47 virtual void Stop(SuspendType suspend_type) = 0; |
| 48 |
| 49 protected: |
| 50 MediaSession() = default; |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 |
| 55 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_ |
| OLD | NEW |