| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ | 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/browser/media/session/media_session_uma_helper.h" | 12 #include "content/browser/media/session/media_session_uma_helper.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
| 16 #include "content/public/common/media_metadata.h" | 16 #include "content/public/common/media_metadata.h" |
| 17 | 17 |
| 18 class MediaSessionBrowserTest; | 18 class MediaSessionBrowserTest; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class MediaSessionDelegate; | 22 class MediaSessionDelegate; |
| 23 class MediaSessionObserver; | 23 class MediaSessionObserver; |
| 24 class MediaSessionVisibilityBrowserTestBase; |
| 24 | 25 |
| 25 // MediaSession manages the media session and audio focus for a given | 26 // MediaSession manages the media session and audio focus for a given |
| 26 // WebContents. It is requesting the audio focus, pausing when requested by the | 27 // WebContents. It is requesting the audio focus, pausing when requested by the |
| 27 // system and dropping it on demand. | 28 // system and dropping it on demand. |
| 28 // The audio focus can be of two types: Transient or Content. A Transient audio | 29 // The audio focus can be of two types: Transient or Content. A Transient audio |
| 29 // focus will allow other players to duck instead of pausing and will be | 30 // focus will allow other players to duck instead of pausing and will be |
| 30 // declared as temporary to the system. A Content audio focus will not be | 31 // declared as temporary to the system. A Content audio focus will not be |
| 31 // declared as temporary and will not allow other players to duck. If a given | 32 // declared as temporary and will not allow other players to duck. If a given |
| 32 // WebContents can only have one audio focus at a time, it will be Content in | 33 // WebContents can only have one audio focus at a time, it will be Content in |
| 33 // case of Transient and Content audio focus are both requested. | 34 // case of Transient and Content audio focus are both requested. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // change all the callers and make the current refactoring ridiculously huge, | 117 // change all the callers and make the current refactoring ridiculously huge, |
| 117 // this method is introduced temporarily and will be removed later. | 118 // this method is introduced temporarily and will be removed later. |
| 118 bool IsReallySuspended() const; | 119 bool IsReallySuspended() const; |
| 119 | 120 |
| 120 // Returns if the session is currently suspended or inactive. | 121 // Returns if the session is currently suspended or inactive. |
| 121 CONTENT_EXPORT bool IsSuspended() const; | 122 CONTENT_EXPORT bool IsSuspended() const; |
| 122 | 123 |
| 123 private: | 124 private: |
| 124 friend class content::WebContentsUserData<MediaSession>; | 125 friend class content::WebContentsUserData<MediaSession>; |
| 125 friend class ::MediaSessionBrowserTest; | 126 friend class ::MediaSessionBrowserTest; |
| 127 friend class content::MediaSessionVisibilityBrowserTestBase; |
| 126 | 128 |
| 127 CONTENT_EXPORT void SetDelegateForTests( | 129 CONTENT_EXPORT void SetDelegateForTests( |
| 128 scoped_ptr<MediaSessionDelegate> delegate); | 130 scoped_ptr<MediaSessionDelegate> delegate); |
| 129 CONTENT_EXPORT bool IsActiveForTest() const; | 131 CONTENT_EXPORT bool IsActiveForTest() const; |
| 130 CONTENT_EXPORT Type audio_focus_type_for_test() const; | 132 CONTENT_EXPORT Type audio_focus_type_for_test() const; |
| 131 CONTENT_EXPORT void RemoveAllPlayersForTest(); | 133 CONTENT_EXPORT void RemoveAllPlayersForTest(); |
| 132 CONTENT_EXPORT MediaSessionUmaHelper* uma_helper_for_test(); | 134 CONTENT_EXPORT MediaSessionUmaHelper* uma_helper_for_test(); |
| 133 | 135 |
| 134 enum class State { | 136 enum class State { |
| 135 ACTIVE, | 137 ACTIVE, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 double volume_multiplier_; | 193 double volume_multiplier_; |
| 192 | 194 |
| 193 MediaMetadata metadata_; | 195 MediaMetadata metadata_; |
| 194 | 196 |
| 195 DISALLOW_COPY_AND_ASSIGN(MediaSession); | 197 DISALLOW_COPY_AND_ASSIGN(MediaSession); |
| 196 }; | 198 }; |
| 197 | 199 |
| 198 } // namespace content | 200 } // namespace content |
| 199 | 201 |
| 200 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ | 202 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ |
| OLD | NEW |