| 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/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 12 #include "public/platform/modules/mediasession/media_session.mojom-blink.h" | 13 #include "public/platform/modules/mediasession/media_session.mojom-blink.h" |
| 13 #include <memory> | 14 #include <memory> |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class MediaMetadata; | 18 class MediaMetadata; |
| 18 class ScriptState; | 19 class ScriptState; |
| 19 | 20 |
| 20 class MODULES_EXPORT MediaSession final : public EventTargetWithInlineData { | 21 class MODULES_EXPORT MediaSession final |
| 22 : public EventTargetWithInlineData, |
| 23 blink::mojom::blink::MediaSessionClient { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
| 22 | 25 |
| 23 public: | 26 public: |
| 24 static MediaSession* create(ScriptState*); | 27 static MediaSession* create(ScriptState*); |
| 25 | 28 |
| 26 void setMetadata(MediaMetadata*); | 29 void setMetadata(MediaMetadata*); |
| 27 MediaMetadata* metadata() const; | 30 MediaMetadata* metadata() const; |
| 28 | 31 |
| 29 // EventTarget implementation. | 32 // EventTarget implementation. |
| 30 const WTF::AtomicString& interfaceName() const override; | 33 const WTF::AtomicString& interfaceName() const override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 48 void setOnseekforward(EventListener*); | 51 void setOnseekforward(EventListener*); |
| 49 void setOnseekbackward(EventListener*); | 52 void setOnseekbackward(EventListener*); |
| 50 | 53 |
| 51 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 friend class MediaSessionTest; | 57 friend class MediaSessionTest; |
| 55 | 58 |
| 56 MediaSession(ScriptState*); | 59 MediaSession(ScriptState*); |
| 57 | 60 |
| 61 // blink::mojom::blink::MediaSessionClient implementation. |
| 62 void DidReceivedAction(const WTF::String& action) override; |
| 63 |
| 58 // Returns null when the ExecutionContext is not document. | 64 // Returns null when the ExecutionContext is not document. |
| 59 mojom::blink::MediaSessionService* getService(ScriptState*); | 65 mojom::blink::MediaSessionService* getService(ScriptState*); |
| 60 | 66 |
| 61 RefPtr<ScriptState> m_scriptState; | 67 RefPtr<ScriptState> m_scriptState; |
| 62 Member<MediaMetadata> m_metadata; | 68 Member<MediaMetadata> m_metadata; |
| 63 mojom::blink::MediaSessionServicePtr m_service; | 69 mojom::blink::MediaSessionServicePtr m_service; |
| 70 mojo::Binding<blink::mojom::blink::MediaSessionClient> m_clientBinding; |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 } // namespace blink | 73 } // namespace blink |
| 67 | 74 |
| 68 #endif // MediaSession_h | 75 #endif // MediaSession_h |
| OLD | NEW |