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 MediaSession_h | 5 #ifndef MediaSession_h |
6 #define MediaSession_h | 6 #define MediaSession_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | |
9 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
11 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
12 #include "public/platform/modules/mediasession/WebMediaSession.h" | 11 #include "public/platform/modules/mediasession/media_session.mojom-blink.h" |
13 #include <memory> | 12 #include <memory> |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
| 16 class ScriptState; |
17 class MediaMetadata; | 17 class MediaMetadata; |
18 class ScriptState; | |
19 | 18 |
20 class MODULES_EXPORT MediaSession final | 19 class MODULES_EXPORT MediaSession final |
21 : public GarbageCollectedFinalized<MediaSession> | 20 : public GarbageCollectedFinalized<MediaSession> |
22 , public ScriptWrappable { | 21 , public ScriptWrappable { |
23 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
24 public: | 23 public: |
25 static MediaSession* create(ExecutionContext*, ExceptionState&); | 24 static MediaSession* create(); |
26 | 25 |
27 WebMediaSession* getWebMediaSession() { return m_webMediaSession.get(); } | 26 void setMetadata(ScriptState*, MediaMetadata*); |
28 | 27 MediaMetadata* metadata(ScriptState*) const; |
29 ScriptPromise activate(ScriptState*); | |
30 ScriptPromise deactivate(ScriptState*); | |
31 | |
32 void setMetadata(MediaMetadata*); | |
33 MediaMetadata* metadata() const; | |
34 | 28 |
35 DECLARE_VIRTUAL_TRACE(); | 29 DECLARE_VIRTUAL_TRACE(); |
36 | 30 |
37 private: | 31 private: |
38 friend class MediaSessionTest; | 32 friend class MediaSessionTest; |
39 | 33 |
40 explicit MediaSession(std::unique_ptr<WebMediaSession>); | 34 MediaSession(); |
41 | 35 |
42 std::unique_ptr<WebMediaSession> m_webMediaSession; | 36 mojom::blink::MediaSessionService* getService(ScriptState*); |
| 37 |
43 Member<MediaMetadata> m_metadata; | 38 Member<MediaMetadata> m_metadata; |
| 39 mojom::blink::MediaSessionServicePtr m_service; |
44 }; | 40 }; |
45 | 41 |
46 } // namespace blink | 42 } // namespace blink |
47 | 43 |
48 #endif // MediaSession_h | 44 #endif // MediaSession_h |
OLD | NEW |