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

Side by Side Diff: content/browser/media/session/media_session.h

Issue 1971443002: Implement Audio Focus Manager for desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix leak in unit tests Created 4 years, 5 months 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 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/callback_list.h" 10 #include "base/callback_list.h"
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/browser/media/session/media_session_uma_helper.h" 13 #include "content/browser/media/session/media_session_uma_helper.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/browser/web_contents_user_data.h" 16 #include "content/public/browser/web_contents_user_data.h"
17 #include "content/public/common/media_metadata.h" 17 #include "content/public/common/media_metadata.h"
18 18
19 class MediaSessionBrowserTest; 19 class MediaSessionBrowserTest;
20 20
21 namespace content { 21 namespace content {
22 22
23 class AudioFocusManagerTest;
23 class MediaSessionDelegate; 24 class MediaSessionDelegate;
24 class MediaSessionObserver; 25 class MediaSessionObserver;
25 class MediaSessionStateObserver; 26 class MediaSessionStateObserver;
26 class MediaSessionVisibilityBrowserTest; 27 class MediaSessionVisibilityBrowserTest;
27 28
28 // MediaSession manages the media session and audio focus for a given 29 // MediaSession manages the media session and audio focus for a given
29 // WebContents. It is requesting the audio focus, pausing when requested by the 30 // WebContents. It is requesting the audio focus, pausing when requested by the
30 // system and dropping it on demand. 31 // system and dropping it on demand.
31 // The audio focus can be of two types: Transient or Content. A Transient audio 32 // The audio focus can be of two types: Transient or Content. A Transient audio
32 // focus will allow other players to duck instead of pausing and will be 33 // focus will allow other players to duck instead of pausing and will be
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // this method is introduced temporarily and will be removed later. 119 // this method is introduced temporarily and will be removed later.
119 bool IsReallySuspended() const; 120 bool IsReallySuspended() const;
120 121
121 // Returns if the session is currently suspended or inactive. 122 // Returns if the session is currently suspended or inactive.
122 CONTENT_EXPORT bool IsSuspended() const; 123 CONTENT_EXPORT bool IsSuspended() const;
123 124
124 private: 125 private:
125 friend class content::WebContentsUserData<MediaSession>; 126 friend class content::WebContentsUserData<MediaSession>;
126 friend class ::MediaSessionBrowserTest; 127 friend class ::MediaSessionBrowserTest;
127 friend class content::MediaSessionVisibilityBrowserTest; 128 friend class content::MediaSessionVisibilityBrowserTest;
129 friend class content::AudioFocusManagerTest;
128 friend class content::MediaSessionStateObserver; 130 friend class content::MediaSessionStateObserver;
129 131
130 CONTENT_EXPORT void SetDelegateForTests( 132 CONTENT_EXPORT void SetDelegateForTests(
131 std::unique_ptr<MediaSessionDelegate> delegate); 133 std::unique_ptr<MediaSessionDelegate> delegate);
132 CONTENT_EXPORT bool IsActiveForTest() const; 134 CONTENT_EXPORT bool IsActiveForTest() const;
133 CONTENT_EXPORT Type audio_focus_type_for_test() const; 135 CONTENT_EXPORT Type audio_focus_type_for_test() const;
134 CONTENT_EXPORT void RemoveAllPlayersForTest(); 136 CONTENT_EXPORT void RemoveAllPlayersForTest();
135 CONTENT_EXPORT MediaSessionUmaHelper* uma_helper_for_test(); 137 CONTENT_EXPORT MediaSessionUmaHelper* uma_helper_for_test();
136 138
137 enum class State { 139 enum class State {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 203
202 MediaMetadata metadata_; 204 MediaMetadata metadata_;
203 base::CallbackList<void(State)> media_session_state_listeners_; 205 base::CallbackList<void(State)> media_session_state_listeners_;
204 206
205 DISALLOW_COPY_AND_ASSIGN(MediaSession); 207 DISALLOW_COPY_AND_ASSIGN(MediaSession);
206 }; 208 };
207 209
208 } // namespace content 210 } // namespace content
209 211
210 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_ 212 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698