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

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

Issue 2623953002: [Chromecast] Fix media session blocking tests. (Closed)
Patch Set: Move MockMediaSession into chromecast/ only Created 3 years, 10 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_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 <map> 10 #include <map>
11 #include <memory>
11 #include <set> 12 #include <set>
12 13
13 #include "base/callback_list.h" 14 #include "base/callback_list.h"
14 #include "base/id_map.h" 15 #include "base/id_map.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/observer_list.h"
17 #include "base/optional.h" 17 #include "base/optional.h"
18 #include "content/browser/media/session/audio_focus_manager.h" 18 #include "content/browser/media/session/audio_focus_manager.h"
19 #include "content/browser/media/session/media_session_uma_helper.h" 19 #include "content/browser/media/session/media_session_uma_helper.h"
20 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
21 #include "content/public/browser/media_session.h" 21 #include "content/public/browser/media_session.h"
22 #include "content/public/browser/media_session_observer.h" 22 #include "content/public/browser/media_session_observer.h"
23 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
24 #include "content/public/browser/web_contents_user_data.h" 24 #include "content/public/browser/web_contents_user_data.h"
25 #include "content/public/common/media_metadata.h" 25 #include "content/public/common/media_metadata.h"
26 26
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ~MediaSessionImpl() override; 78 ~MediaSessionImpl() override;
79 79
80 #if defined(OS_ANDROID) 80 #if defined(OS_ANDROID)
81 static MediaSession* FromJavaMediaSession( 81 static MediaSession* FromJavaMediaSession(
82 const base::android::JavaRef<jobject>& j_media_session); 82 const base::android::JavaRef<jobject>& j_media_session);
83 MediaSessionAndroid* session_android() const { 83 MediaSessionAndroid* session_android() const {
84 return session_android_.get(); 84 return session_android_.get();
85 } 85 }
86 #endif // defined(OS_ANDROID) 86 #endif // defined(OS_ANDROID)
87 87
88 void AddObserver(MediaSessionObserver* observer);
89 void RemoveObserver(MediaSessionObserver* observer);
90
91 void NotifyMediaSessionMetadataChange( 88 void NotifyMediaSessionMetadataChange(
92 const base::Optional<MediaMetadata>& metadata); 89 const base::Optional<MediaMetadata>& metadata);
93 void NotifyMediaSessionActionsChange( 90 void NotifyMediaSessionActionsChange(
94 const std::set<blink::mojom::MediaSessionAction>& actions); 91 const std::set<blink::mojom::MediaSessionAction>& actions);
95 92
96 // Adds the given player to the current media session. Returns whether the 93 // Adds the given player to the current media session. Returns whether the
97 // player was successfully added. If it returns false, AddPlayer() should be 94 // player was successfully added. If it returns false, AddPlayer() should be
98 // called again later. 95 // called again later.
99 CONTENT_EXPORT bool AddPlayer(MediaSessionPlayerObserver* observer, 96 CONTENT_EXPORT bool AddPlayer(MediaSessionPlayerObserver* observer,
100 int player_id, 97 int player_id,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 286
290 MediaSessionUmaHelper uma_helper_; 287 MediaSessionUmaHelper uma_helper_;
291 288
292 // The ducking state of this media session. The initial value is |false|, and 289 // The ducking state of this media session. The initial value is |false|, and
293 // is set to |true| after StartDucking(), and will be set to |false| after 290 // is set to |true| after StartDucking(), and will be set to |false| after
294 // StopDucking(). 291 // StopDucking().
295 bool is_ducking_; 292 bool is_ducking_;
296 293
297 base::CallbackList<void(State)> media_session_state_listeners_; 294 base::CallbackList<void(State)> media_session_state_listeners_;
298 295
299 base::ObserverList<MediaSessionObserver> observers_;
300
301 #if defined(OS_ANDROID) 296 #if defined(OS_ANDROID)
302 std::unique_ptr<MediaSessionAndroid> session_android_; 297 std::unique_ptr<MediaSessionAndroid> session_android_;
303 #endif // defined(OS_ANDROID) 298 #endif // defined(OS_ANDROID)
304 299
305 // MediaSessionService-related fields 300 // MediaSessionService-related fields
306 using ServicesMap = std::map<RenderFrameHost*, MediaSessionServiceImpl*>; 301 using ServicesMap = std::map<RenderFrameHost*, MediaSessionServiceImpl*>;
307 302
308 // The collection of all managed services (non-owned pointers). The services 303 // The collection of all managed services (non-owned pointers). The services
309 // are owned by RenderFrameHost and should be registered on creation and 304 // are owned by RenderFrameHost and should be registered on creation and
310 // unregistered on destroy. 305 // unregistered on destroy.
311 ServicesMap services_; 306 ServicesMap services_;
312 // The currently routed service (non-owned pointer). 307 // The currently routed service (non-owned pointer).
313 MediaSessionServiceImpl* routed_service_; 308 MediaSessionServiceImpl* routed_service_;
314 309
315 DISALLOW_COPY_AND_ASSIGN(MediaSessionImpl); 310 DISALLOW_COPY_AND_ASSIGN(MediaSessionImpl);
316 }; 311 };
317 312
318 } // namespace content 313 } // namespace content
319 314
320 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_H_ 315 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698