| 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_ANDROID_MEDIA_SESSION_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_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/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "content/browser/media/android/media_session_observer.h" | 10 #include "content/browser/media/session/media_session_observer.h" |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 class MediaSession; | 16 class MediaSession; |
| 16 class MediaWebContentsObserver; | 17 class MediaWebContentsObserver; |
| 17 | 18 |
| 18 // Helper class for controlling a single player's MediaSession instance. Sends | 19 // Helper class for controlling a single player's MediaSession instance. Sends |
| 19 // browser side MediaSession commands back to a player hosted in the renderer | 20 // browser side MediaSession commands back to a player hosted in the renderer |
| 20 // process. | 21 // process. |
| 21 class CONTENT_EXPORT MediaSessionController : public MediaSessionObserver { | 22 class CONTENT_EXPORT MediaSessionController : |
| 23 NON_EXPORTED_BASE(public MediaSessionObserver) { |
| 22 public: | 24 public: |
| 23 MediaSessionController(const WebContentsObserver::MediaPlayerId& id, | 25 MediaSessionController(const WebContentsObserver::MediaPlayerId& id, |
| 24 MediaWebContentsObserver* media_web_contents_observer); | 26 MediaWebContentsObserver* media_web_contents_observer); |
| 25 ~MediaSessionController() override; | 27 ~MediaSessionController() override; |
| 26 | 28 |
| 27 // Minimum duration of content for a MediaSession instance to be created. | 29 // Minimum duration of content for a MediaSession instance to be created. |
| 28 enum { kMinimumDurationForContentSecs = 5 }; | 30 enum { kMinimumDurationForContentSecs = 5 }; |
| 29 | 31 |
| 30 // Clients must call this after construction and destroy the controller if it | 32 // Clients must call this after construction and destroy the controller if it |
| 31 // returns false. May be called more than once; does nothing if none of the | 33 // returns false. May be called more than once; does nothing if none of the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 MediaSession* const media_session_; | 61 MediaSession* const media_session_; |
| 60 | 62 |
| 61 int player_id_ = 0; | 63 int player_id_ = 0; |
| 62 bool has_session_ = false; | 64 bool has_session_ = false; |
| 63 | 65 |
| 64 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); | 66 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 } // namespace content | 69 } // namespace content |
| 68 | 70 |
| 69 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ | 71 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| OLD | NEW |