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

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

Issue 1698933004: Make MediaSession a runtime-enabled feature on Desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove windows specific stuff Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_
7
8 #include <map>
9 #include <utility>
10
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/time.h"
14
15 namespace content {
16
17 class MediaSessionController;
18 class MediaWebContentsObserver;
19 class RenderFrameHost;
20
21 using MediaPlayerId = std::pair<RenderFrameHost*, int>;
DaleCurtis 2016/02/26 03:22:50 Why not include web_contents_observer.h to get thi
mlamouri (slow - plz ping) 2016/02/26 12:26:17 I don't really like the idea of including a file l
22
23 // MediaSessionControllersManager is a delegate of MediaWebContentsObserver that
24 // handles MediaSessionController instances.
25 class MediaSessionControllersManager {
DaleCurtis 2016/02/26 03:22:50 You'll want CONTENT_EXPORT if you're planning to w
mlamouri (slow - plz ping) 2016/02/26 12:26:17 There are no tests for this. I don't think adding
26 public:
27 explicit MediaSessionControllersManager(
28 MediaWebContentsObserver* media_web_contents_observer);
29 ~MediaSessionControllersManager();
30
31 // Clear all the MediaSessionController associated with the given
32 // |render_frame_host|.
33 void Clear(RenderFrameHost* render_frame_host);
34
35 // Called before a player starts playing. It will be added to the media
36 // session and will have a controller associated with it.
37 // Returns whether the player was added to the session and can start playing.
38 bool RequestPlay(const MediaPlayerId& id, bool has_audio, bool is_remote,
39 base::TimeDelta duration);
40
41 // Called when the given player |id| has paused.
42 void OnPause(const MediaPlayerId& id);
43
44 // Called when the given player |id| has ended.
45 void OnEnd(const MediaPlayerId& id);
46
47 private:
48 static bool IsDefaultMediaSessionEnabled();
DaleCurtis 2016/02/26 03:22:50 Keep as a .cc local method?
mlamouri (slow - plz ping) 2016/02/26 12:26:17 Done.
49
50 // Weak pointer because |this| is owned by |media_web_contents_observer_|.
51 MediaWebContentsObserver* const media_web_contents_observer_;
52
53 using ControllersMap =
54 std::map<MediaPlayerId, scoped_ptr<MediaSessionController>>;
55 ControllersMap controllers_map_;
56
57 DISALLOW_COPY_AND_ASSIGN(MediaSessionControllersManager);
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLERS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698