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

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

Issue 2479603003: Revert of Adding new media controls to MediaNotification (Closed)
Patch Set: Created 4 years, 1 month 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_IMPL_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_H_ 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_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"
(...skipping 21 matching lines...) Expand all
32 } // namespace media 32 } // namespace media
33 33
34 namespace content { 34 namespace content {
35 35
36 class AudioFocusDelegate; 36 class AudioFocusDelegate;
37 class AudioFocusManagerTest; 37 class AudioFocusManagerTest;
38 class MediaSessionImplStateObserver; 38 class MediaSessionImplStateObserver;
39 class MediaSessionImplVisibilityBrowserTest; 39 class MediaSessionImplVisibilityBrowserTest;
40 class MediaSessionObserver; 40 class MediaSessionObserver;
41 class MediaSessionPlayerObserver; 41 class MediaSessionPlayerObserver;
42 class MediaSessionServiceImpl;
43 42
44 #if defined(OS_ANDROID) 43 #if defined(OS_ANDROID)
45 class MediaSessionAndroid; 44 class MediaSessionAndroid;
46 #endif // defined(OS_ANDROID) 45 #endif // defined(OS_ANDROID)
47 46
48 // MediaSessionImpl is the implementation of MediaSession. It manages the media 47 // MediaSessionImpl is the implementation of MediaSession. It manages the media
49 // session and audio focus for a given WebContents. It is requesting the audio 48 // session and audio focus for a given WebContents. It is requesting the audio
50 // focus, pausing when requested by the system and dropping it on demand. The 49 // focus, pausing when requested by the system and dropping it on demand. The
51 // audio focus can be of two types: Transient or Content. A Transient audio 50 // audio focus can be of two types: Transient or Content. A Transient audio
52 // focus will allow other players to duck instead of pausing and will be 51 // focus will allow other players to duck instead of pausing and will be
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 CONTENT_EXPORT void Resume(MediaSession::SuspendType suspend_type) override; 116 CONTENT_EXPORT void Resume(MediaSession::SuspendType suspend_type) override;
118 117
119 // Suspend the media session. 118 // Suspend the media session.
120 // |type| represents the origin of the request. 119 // |type| represents the origin of the request.
121 CONTENT_EXPORT void Suspend(MediaSession::SuspendType suspend_type) override; 120 CONTENT_EXPORT void Suspend(MediaSession::SuspendType suspend_type) override;
122 121
123 // Stop the media session. 122 // Stop the media session.
124 // |type| represents the origin of the request. 123 // |type| represents the origin of the request.
125 CONTENT_EXPORT void Stop(MediaSession::SuspendType suspend_type) override; 124 CONTENT_EXPORT void Stop(MediaSession::SuspendType suspend_type) override;
126 125
127 // Received a media session action and forward to blink::MediaSession.
128 void DidReceiveAction(blink::mojom::MediaSessionAction action) override;
129
130 // Called when an action is enabled in blink::MediaSession. This method will
131 // notify the observers that the action is enabled.
132 void OnMediaSessionEnabledAction(blink::mojom::MediaSessionAction action);
133
134 // Called when an action is disabled in blink::MediaSession. This method will
135 // notify the observers that the action is disabled.
136 void OnMediaSessionDisabledAction(blink::mojom::MediaSessionAction action);
137
138 // Let the media session start ducking such that the volume multiplier is 126 // Let the media session start ducking such that the volume multiplier is
139 // reduced. 127 // reduced.
140 CONTENT_EXPORT void StartDucking(); 128 CONTENT_EXPORT void StartDucking();
141 129
142 // Let the media session stop ducking such that the volume multiplier is 130 // Let the media session stop ducking such that the volume multiplier is
143 // recovered. 131 // recovered.
144 CONTENT_EXPORT void StopDucking(); 132 CONTENT_EXPORT void StopDucking();
145 133
146 // Returns if the session can be controlled by Resume() and Suspend calls 134 // Returns if the session can be controlled by Resume() and Suspend calls
147 // above. 135 // above.
(...skipping 17 matching lines...) Expand all
165 CONTENT_EXPORT AudioFocusManager::AudioFocusType audio_focus_type() const { 153 CONTENT_EXPORT AudioFocusManager::AudioFocusType audio_focus_type() const {
166 return audio_focus_type_; 154 return audio_focus_type_;
167 } 155 }
168 156
169 // Returns whether the session has Pepper instances. 157 // Returns whether the session has Pepper instances.
170 bool HasPepper() const; 158 bool HasPepper() const;
171 159
172 // WebContentsObserver implementation 160 // WebContentsObserver implementation
173 void WebContentsDestroyed() override; 161 void WebContentsDestroyed() override;
174 162
175 // Sets the associated MediaSessionService for communicating with
176 // blink::MediaSession.
177 MediaSessionServiceImpl* GetMediaSessionService() { return service_; }
178 void SetMediaSessionService(MediaSessionServiceImpl* service);
179
180 private: 163 private:
181 friend class content::WebContentsUserData<MediaSessionImpl>; 164 friend class content::WebContentsUserData<MediaSessionImpl>;
182 friend class ::MediaSessionImplBrowserTest; 165 friend class ::MediaSessionImplBrowserTest;
183 friend class content::MediaSessionImplVisibilityBrowserTest; 166 friend class content::MediaSessionImplVisibilityBrowserTest;
184 friend class content::AudioFocusManagerTest; 167 friend class content::AudioFocusManagerTest;
185 friend class content::MediaSessionImplStateObserver; 168 friend class content::MediaSessionImplStateObserver;
186 169
187 CONTENT_EXPORT void SetDelegateForTests( 170 CONTENT_EXPORT void SetDelegateForTests(
188 std::unique_ptr<AudioFocusDelegate> delegate); 171 std::unique_ptr<AudioFocusDelegate> delegate);
189 CONTENT_EXPORT bool IsActiveForTest() const; 172 CONTENT_EXPORT bool IsActiveForTest() const;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 248
266 base::Optional<MediaMetadata> metadata_; 249 base::Optional<MediaMetadata> metadata_;
267 base::CallbackList<void(State)> media_session_state_listeners_; 250 base::CallbackList<void(State)> media_session_state_listeners_;
268 251
269 base::ObserverList<MediaSessionObserver> observers_; 252 base::ObserverList<MediaSessionObserver> observers_;
270 253
271 #if defined(OS_ANDROID) 254 #if defined(OS_ANDROID)
272 std::unique_ptr<MediaSessionAndroid> session_android_; 255 std::unique_ptr<MediaSessionAndroid> session_android_;
273 #endif // defined(OS_ANDROID) 256 #endif // defined(OS_ANDROID)
274 257
275 // The MediaSessionService this session is associated with (the service of the
276 // top-level frame).
277 MediaSessionServiceImpl* service_;
278
279 DISALLOW_COPY_AND_ASSIGN(MediaSessionImpl); 258 DISALLOW_COPY_AND_ASSIGN(MediaSessionImpl);
280 }; 259 };
281 260
282 } // namespace content 261 } // namespace content
283 262
284 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_H_ 263 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session_android.cc ('k') | content/browser/media/session/media_session_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698