| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebMediaSession_h | 5 #ifndef WebMediaSession_h |
| 6 #define WebMediaSession_h | 6 #define WebMediaSession_h |
| 7 | 7 |
| 8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
| 9 #include "public/platform/modules/mediasession/WebMediaSessionError.h" | 9 #include "public/platform/modules/mediasession/WebMediaSessionError.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 using WebMediaSessionActivateCallback = WebCallbacks<void, const WebMediaSession
Error&>; | 13 using WebMediaSessionActivateCallback = WebCallbacks<void, const WebMediaSession
Error&>; |
| 14 using WebMediaSessionDeactivateCallback = WebCallbacks<void, void>; | 14 using WebMediaSessionDeactivateCallback = WebCallbacks<void, void>; |
| 15 | 15 |
| 16 struct WebMediaMetadata; | 16 struct WebMediaMetadata; |
| 17 | 17 |
| 18 class WebMediaSession { | 18 class WebMediaSession { |
| 19 public: | 19 public: |
| 20 enum { | 20 enum { |
| 21 // The media session for media elements that don't have an |
| 22 // explicit user created media session set. |
| 21 DefaultID = 0 | 23 DefaultID = 0 |
| 22 }; | 24 }; |
| 23 | 25 |
| 24 virtual ~WebMediaSession() = default; | 26 virtual ~WebMediaSession() = default; |
| 25 | 27 |
| 26 // Tries to activate the session by requesting audio focus from | 28 // Tries to activate the session by requesting audio focus from |
| 27 // the system. May fail if audio focus is denied by the | 29 // the system. May fail if audio focus is denied by the |
| 28 // system. The ownership of the pointer is transferred to the | 30 // system. The ownership of the pointer is transferred to the |
| 29 // WebMediaSession implementation. | 31 // WebMediaSession implementation. |
| 30 virtual void activate(WebMediaSessionActivateCallback*) = 0; | 32 virtual void activate(WebMediaSessionActivateCallback*) = 0; |
| 31 | 33 |
| 32 // Deactivates the session by abandoning audio focus. Will not | 34 // Deactivates the session by abandoning audio focus. Will not |
| 33 // fail in way visible to the user of the WebMediaSession. The | 35 // fail in way visible to the user of the WebMediaSession. The |
| 34 // ownership of the pointer is transferred to the WebMediaSession | 36 // ownership of the pointer is transferred to the WebMediaSession |
| 35 // implementation. | 37 // implementation. |
| 36 virtual void deactivate(WebMediaSessionDeactivateCallback*) = 0; | 38 virtual void deactivate(WebMediaSessionDeactivateCallback*) = 0; |
| 37 | 39 |
| 38 // Updates the metadata associated with the WebMediaSession. The metadata | 40 // Updates the metadata associated with the WebMediaSession. The metadata |
| 39 // can be a nullptr in which case the assouciated metadata should be reset. | 41 // can be a nullptr in which case the assouciated metadata should be reset. |
| 40 // The pointer is not owned by the WebMediaSession implementation. | 42 // The pointer is not owned by the WebMediaSession implementation. |
| 41 virtual void setMetadata(const WebMediaMetadata*) = 0; | 43 virtual void setMetadata(const WebMediaMetadata*) = 0; |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace blink | 46 } // namespace blink |
| 45 | 47 |
| 46 #endif // WebMediaSession_h | 48 #endif // WebMediaSession_h |
| OLD | NEW |