Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/media/session/media_session_observer.h" | 10 #include "content/browser/media/session/media_session_observer.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 | 13 |
| 14 namespace media { | |
|
whywhat
2016/08/18 20:33:42
nit: ditto the namespaced forward declaration styl
Zhiqiang Zhang (Slow)
2016/08/19 15:05:55
Done.
| |
| 15 | |
| 16 enum class MediaContentType; | |
| 17 } | |
| 18 | |
| 14 namespace content { | 19 namespace content { |
| 15 | 20 |
| 16 class MediaSession; | 21 class MediaSession; |
| 17 class MediaWebContentsObserver; | 22 class MediaWebContentsObserver; |
| 18 | 23 |
| 19 // Helper class for controlling a single player's MediaSession instance. Sends | 24 // Helper class for controlling a single player's MediaSession instance. Sends |
| 20 // browser side MediaSession commands back to a player hosted in the renderer | 25 // browser side MediaSession commands back to a player hosted in the renderer |
| 21 // process. | 26 // process. |
| 22 class CONTENT_EXPORT MediaSessionController : | 27 class CONTENT_EXPORT MediaSessionController : |
| 23 NON_EXPORTED_BASE(public MediaSessionObserver) { | 28 NON_EXPORTED_BASE(public MediaSessionObserver) { |
| 24 public: | 29 public: |
| 25 MediaSessionController(const WebContentsObserver::MediaPlayerId& id, | 30 MediaSessionController(const WebContentsObserver::MediaPlayerId& id, |
| 26 MediaWebContentsObserver* media_web_contents_observer); | 31 MediaWebContentsObserver* media_web_contents_observer); |
| 27 ~MediaSessionController() override; | 32 ~MediaSessionController() override; |
| 28 | 33 |
| 29 // Minimum duration of content for a MediaSession instance to be created. | 34 // Minimum duration of content for a MediaSession instance to be created. |
| 30 enum { kMinimumDurationForContentSecs = 5 }; | 35 enum { kMinimumDurationForContentSecs = 5 }; |
| 31 | 36 |
| 32 // Clients must call this after construction and destroy the controller if it | 37 // Clients must call this after construction and destroy the controller if it |
| 33 // returns false. May be called more than once; does nothing if none of the | 38 // returns false. May be called more than once; does nothing if none of the |
| 34 // input parameters have changed since the last call. | 39 // input parameters have changed since the last call. |
| 35 // | 40 // |
| 36 // Note: Once a session has been initialized with |has_audio| as true, all | 41 // Note: Once a session has been initialized with |has_audio| as true, all |
| 37 // future calls to Initialize() will retain this flag. | 42 // future calls to Initialize() will retain this flag. |
| 38 // TODO(dalecurtis): Delete sticky audio once we're no longer using WMPA and | 43 // TODO(dalecurtis): Delete sticky audio once we're no longer using WMPA and |
| 39 // the BrowserMediaPlayerManagers. Tracked by http://crbug.com/580626 | 44 // the BrowserMediaPlayerManagers. Tracked by http://crbug.com/580626 |
| 40 bool Initialize(bool has_audio, bool is_remote, base::TimeDelta duration); | 45 bool Initialize(bool has_audio, |
| 46 bool is_remote, | |
| 47 media::MediaContentType media_session_type); | |
| 41 | 48 |
| 42 // Must be called when a pause occurs on the renderer side media player; keeps | 49 // Must be called when a pause occurs on the renderer side media player; keeps |
| 43 // the MediaSession instance in sync with renderer side behavior. | 50 // the MediaSession instance in sync with renderer side behavior. |
| 44 void OnPlaybackPaused(); | 51 void OnPlaybackPaused(); |
| 45 | 52 |
| 46 // MediaSessionObserver implementation. | 53 // MediaSessionObserver implementation. |
| 47 void OnSuspend(int player_id) override; | 54 void OnSuspend(int player_id) override; |
| 48 void OnResume(int player_id) override; | 55 void OnResume(int player_id) override; |
| 49 void OnSetVolumeMultiplier(int player_id, double volume_multiplier) override; | 56 void OnSetVolumeMultiplier(int player_id, double volume_multiplier) override; |
| 50 | 57 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 62 | 69 |
| 63 int player_id_ = 0; | 70 int player_id_ = 0; |
| 64 bool has_session_ = false; | 71 bool has_session_ = false; |
| 65 | 72 |
| 66 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); | 73 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); |
| 67 }; | 74 }; |
| 68 | 75 |
| 69 } // namespace content | 76 } // namespace content |
| 70 | 77 |
| 71 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ | 78 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| OLD | NEW |