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