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