| Index: content/public/browser/media_session.h
|
| diff --git a/content/public/browser/media_session.h b/content/public/browser/media_session.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9d92b77eaf598ff570fc21347bb87482236ccb48
|
| --- /dev/null
|
| +++ b/content/public/browser/media_session.h
|
| @@ -0,0 +1,55 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
|
| +#define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "content/common/content_export.h"
|
| +
|
| +namespace content {
|
| +
|
| +class WebContents;
|
| +
|
| +// MediaSession manages the media session and audio focus for a given
|
| +// WebContents. There is only one MediaSession per WebContents.
|
| +//
|
| +// MediaSession allows clients to observe its changes via MediaSessionObserver,
|
| +// and allows clients to resume/suspend/stop the managed players.
|
| +class MediaSession {
|
| + public:
|
| + enum class SuspendType {
|
| + // Suspended by the system because a transient sound needs to be played.
|
| + SYSTEM,
|
| + // Suspended by the UI.
|
| + UI,
|
| + // Suspended by the page via script or user interaction.
|
| + CONTENT,
|
| + };
|
| +
|
| + // Returns the MediaSession associated to this WebContents. Creates one if
|
| + // none is currently available.
|
| + CONTENT_EXPORT static MediaSession* Get(WebContents* contents);
|
| +
|
| + virtual ~MediaSession() = default;
|
| +
|
| + // Resume the media session.
|
| + // |type| represents the origin of the request.
|
| + virtual void Resume(SuspendType suspend_type) = 0;
|
| +
|
| + // Resume the media session.
|
| + // |type| represents the origin of the request.
|
| + virtual void Suspend(SuspendType suspend_type) = 0;
|
| +
|
| + // Resume the media session.
|
| + // |type| represents the origin of the request.
|
| + virtual void Stop(SuspendType suspend_type) = 0;
|
| +
|
| + protected:
|
| + MediaSession() = default;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_H_
|
|
|