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

Side by Side Diff: content/public/browser/media_session.h

Issue 2441423002: Add MediaSessionObserver to allow clients observe MediaSession directly (Closed)
Patch Set: fixed Android build 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
(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_PUBLIC_BROWSER_MEDIA_SESSION_H_
6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
7
8 #include "base/macros.h"
9 #include "content/common/content_export.h"
10
11 namespace content {
12
13 class WebContents;
14
15 // MediaSession manages the media session and audio focus for a given
16 // WebContents. There is only one MediaSession per WebContents. The underlying
17 // implementation will request audio focus when players want to play audio, and
whywhat 2016/10/24 20:29:39 nit: Don't think sharing the implementation detail
Zhiqiang Zhang (Slow) 2016/10/25 19:51:43 Removed.
18 // will respond to audio focus changes (such as another tab or app start to
19 // produce audio).
20 //
21 // MediaSession allows clients to observe its changes via MediaSessionObserver,
22 // and allow clients to resume/suspend/stop the managed players. MediaSession is
whywhat 2016/10/24 20:29:39 nit: s/allow/allows
Zhiqiang Zhang (Slow) 2016/10/25 19:51:43 Done.
23 // also the interface for communicating with blink::MediaSession.
whywhat 2016/10/24 20:29:39 nit: same w/r/t sharing the implementation details
Zhiqiang Zhang (Slow) 2016/10/25 19:51:43 Done.
24 class MediaSession {
25 public:
26 enum class SuspendType {
27 // Suspended by the system because a transient sound needs to be played.
28 SYSTEM,
29 // Suspended by the UI.
30 UI,
31 // Suspended by the page via script or user interaction.
32 CONTENT,
33 };
34
35 // Returns the MediaSession associated to this WebContents. Creates one if
36 // none is currently available.
37 CONTENT_EXPORT static MediaSession* Get(WebContents* contents);
38
39 virtual ~MediaSession() = default;
40
41 // Resume the media session.
42 // |type| represents the origin of the request.
43 virtual void Resume(SuspendType suspend_type) = 0;
44
45 // Resume the media session.
46 // |type| represents the origin of the request.
47 virtual void Suspend(SuspendType suspend_type) = 0;
48
49 // Resume the media session.
50 // |type| represents the origin of the request.
51 virtual void Stop(SuspendType suspend_type) = 0;
52
53 private:
54 // This interface should only be implemented inside content.
55 friend class MediaSessionImpl;
56 MediaSession() = default;
57 };
58
59 } // namespace content
60
61 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698