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

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

Issue 1996043002: Split MediaContentType and AudioFocusType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Mounir's comments Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 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 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_CONTROLLERS_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_ 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/public/browser/web_contents_observer.h" // For MediaPlayerId. 14 #include "content/public/browser/web_contents_observer.h" // For MediaPlayerId.
15 15
16 namespace media {
whywhat 2016/08/18 20:33:42 nit: ditto
Zhiqiang Zhang (Slow) 2016/08/19 15:05:55 Done.
17
18 enum class MediaContentType;
19 }
20
16 namespace content { 21 namespace content {
17 22
18 class MediaSessionController; 23 class MediaSessionController;
19 class MediaWebContentsObserver; 24 class MediaWebContentsObserver;
20 class RenderFrameHost; 25 class RenderFrameHost;
21 26
22 // MediaSessionControllersManager is a delegate of MediaWebContentsObserver that 27 // MediaSessionControllersManager is a delegate of MediaWebContentsObserver that
23 // handles MediaSessionController instances. 28 // handles MediaSessionController instances.
24 class MediaSessionControllersManager { 29 class MediaSessionControllersManager {
25 public: 30 public:
26 using MediaPlayerId = WebContentsObserver::MediaPlayerId; 31 using MediaPlayerId = WebContentsObserver::MediaPlayerId;
27 32
28 explicit MediaSessionControllersManager( 33 explicit MediaSessionControllersManager(
29 MediaWebContentsObserver* media_web_contents_observer); 34 MediaWebContentsObserver* media_web_contents_observer);
30 ~MediaSessionControllersManager(); 35 ~MediaSessionControllersManager();
31 36
32 // Clear all the MediaSessionController associated with the given 37 // Clear all the MediaSessionController associated with the given
33 // |render_frame_host|. 38 // |render_frame_host|.
34 void RenderFrameDeleted(RenderFrameHost* render_frame_host); 39 void RenderFrameDeleted(RenderFrameHost* render_frame_host);
35 40
36 // Called before a player starts playing. It will be added to the media 41 // Called before a player starts playing. It will be added to the media
37 // session and will have a controller associated with it. 42 // session and will have a controller associated with it.
38 // Returns whether the player was added to the session and can start playing. 43 // Returns whether the player was added to the session and can start playing.
39 bool RequestPlay(const MediaPlayerId& id, 44 bool RequestPlay(const MediaPlayerId& id,
40 bool has_audio, 45 bool has_audio,
41 bool is_remote, 46 bool is_remote,
42 base::TimeDelta duration); 47 media::MediaContentType media_content_type);
43 48
44 // Called when the given player |id| has paused. 49 // Called when the given player |id| has paused.
45 void OnPause(const MediaPlayerId& id); 50 void OnPause(const MediaPlayerId& id);
46 51
47 // Called when the given player |id| has ended. 52 // Called when the given player |id| has ended.
48 void OnEnd(const MediaPlayerId& id); 53 void OnEnd(const MediaPlayerId& id);
49 54
50 private: 55 private:
51 // Weak pointer because |this| is owned by |media_web_contents_observer_|. 56 // Weak pointer because |this| is owned by |media_web_contents_observer_|.
52 MediaWebContentsObserver* const media_web_contents_observer_; 57 MediaWebContentsObserver* const media_web_contents_observer_;
53 58
54 using ControllersMap = 59 using ControllersMap =
55 std::map<MediaPlayerId, std::unique_ptr<MediaSessionController>>; 60 std::map<MediaPlayerId, std::unique_ptr<MediaSessionController>>;
56 ControllersMap controllers_map_; 61 ControllersMap controllers_map_;
57 62
58 DISALLOW_COPY_AND_ASSIGN(MediaSessionControllersManager); 63 DISALLOW_COPY_AND_ASSIGN(MediaSessionControllersManager);
59 }; 64 };
60 65
61 } // namespace content 66 } // namespace content
62 67
63 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_ 68 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698