Chromium Code Reviews| 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 |
| 17 class MediaMetadata; | 16 class MediaMetadata; |
| 17 | |
|
foolip
2016/10/03 16:26:35
Cat on keyboard?
Zhiqiang Zhang (Slow)
2016/10/03 20:21:00
Done.
| |
| 18 class ScriptState; | 18 class ScriptState; |
| 19 | 19 |
| 20 class MODULES_EXPORT MediaSession final | 20 class MODULES_EXPORT MediaSession final |
| 21 : public GarbageCollectedFinalized<MediaSession>, | 21 : public GarbageCollectedFinalized<MediaSession>, |
| 22 public ScriptWrappable { | 22 public ScriptWrappable { |
| 23 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
| 24 | 24 |
| 25 public: | 25 public: |
| 26 static MediaSession* create(ExecutionContext*, ExceptionState&); | 26 static MediaSession* create(); |
| 27 | 27 |
| 28 WebMediaSession* getWebMediaSession() { return m_webMediaSession.get(); } | 28 void setMetadata(ScriptState*, MediaMetadata*); |
| 29 | 29 MediaMetadata* metadata(ScriptState*) const; |
| 30 ScriptPromise activate(ScriptState*); | |
| 31 ScriptPromise deactivate(ScriptState*); | |
| 32 | |
| 33 void setMetadata(MediaMetadata*); | |
| 34 MediaMetadata* metadata() const; | |
| 35 | 30 |
| 36 DECLARE_VIRTUAL_TRACE(); | 31 DECLARE_VIRTUAL_TRACE(); |
| 37 | 32 |
| 38 private: | 33 private: |
| 39 friend class MediaSessionTest; | 34 friend class MediaSessionTest; |
| 40 | 35 |
| 41 explicit MediaSession(std::unique_ptr<WebMediaSession>); | 36 MediaSession(); |
| 42 | 37 |
| 43 std::unique_ptr<WebMediaSession> m_webMediaSession; | 38 mojom::blink::MediaSession* getService(ScriptState*); |
|
foolip
2016/10/03 16:26:35
Document when this can return null and not?
Zhiqiang Zhang (Slow)
2016/10/03 20:21:00
Done.
| |
| 39 | |
| 44 Member<MediaMetadata> m_metadata; | 40 Member<MediaMetadata> m_metadata; |
| 41 mojom::blink::MediaSessionPtr m_service; | |
| 45 }; | 42 }; |
| 46 | 43 |
| 47 } // namespace blink | 44 } // namespace blink |
| 48 | 45 |
| 49 #endif // MediaSession_h | 46 #endif // MediaSession_h |
| OLD | NEW |