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

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

Issue 2453623003: Decouple MediaSession messages from WebContents (full patch) (Closed)
Patch Set: nit 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
« no previous file with comments | « content/public/browser/BUILD.gn ('k') | content/public/browser/media_session_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
17 //
18 // MediaSession allows clients to observe its changes via MediaSessionObserver,
19 // and allows clients to resume/suspend/stop the managed players.
20 class MediaSession {
21 public:
22 enum class SuspendType {
23 // Suspended by the system because a transient sound needs to be played.
24 SYSTEM,
25 // Suspended by the UI.
26 UI,
27 // Suspended by the page via script or user interaction.
28 CONTENT,
29 };
30
31 // Returns the MediaSession associated to this WebContents. Creates one if
32 // none is currently available.
33 CONTENT_EXPORT static MediaSession* Get(WebContents* contents);
34
35 virtual ~MediaSession() = default;
36
37 // Resume the media session.
38 // |type| represents the origin of the request.
39 virtual void Resume(SuspendType suspend_type) = 0;
40
41 // Resume the media session.
42 // |type| represents the origin of the request.
43 virtual void Suspend(SuspendType suspend_type) = 0;
44
45 // Resume the media session.
46 // |type| represents the origin of the request.
47 virtual void Stop(SuspendType suspend_type) = 0;
48
49 protected:
50 MediaSession() = default;
51 };
52
53 } // namespace content
54
55 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
OLDNEW
« no previous file with comments | « content/public/browser/BUILD.gn ('k') | content/public/browser/media_session_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698