| 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/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 blink::mojom::blink::MediaSessionClient { | 25 blink::mojom::blink::MediaSessionClient { |
| 26 USING_GARBAGE_COLLECTED_MIXIN(MediaSession); | 26 USING_GARBAGE_COLLECTED_MIXIN(MediaSession); |
| 27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
| 28 USING_PRE_FINALIZER(MediaSession, dispose); | 28 USING_PRE_FINALIZER(MediaSession, dispose); |
| 29 | 29 |
| 30 public: | 30 public: |
| 31 static MediaSession* create(ExecutionContext*); | 31 static MediaSession* create(ExecutionContext*); |
| 32 | 32 |
| 33 void dispose(); | 33 void dispose(); |
| 34 | 34 |
| 35 void setPlaybackState(const String&); |
| 36 String playbackState(); |
| 37 |
| 35 void setMetadata(MediaMetadata*); | 38 void setMetadata(MediaMetadata*); |
| 36 MediaMetadata* metadata() const; | 39 MediaMetadata* metadata() const; |
| 37 | 40 |
| 38 // EventTarget implementation. | 41 // EventTarget implementation. |
| 39 const WTF::AtomicString& interfaceName() const override; | 42 const WTF::AtomicString& interfaceName() const override; |
| 40 ExecutionContext* getExecutionContext() const override; | 43 ExecutionContext* getExecutionContext() const override; |
| 41 | 44 |
| 42 // Called by the MediaMetadata owned by |this| when it has updates. Also used | 45 // Called by the MediaMetadata owned by |this| when it has updates. Also used |
| 43 // internally when a new MediaMetadata object is set. | 46 // internally when a new MediaMetadata object is set. |
| 44 void onMetadataChanged(); | 47 void onMetadataChanged(); |
| 45 | 48 |
| 46 DEFINE_ATTRIBUTE_EVENT_LISTENER(play); | 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(play); |
| 47 DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); | 50 DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); |
| 48 DEFINE_ATTRIBUTE_EVENT_LISTENER(playpause); | |
| 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(previoustrack); | 51 DEFINE_ATTRIBUTE_EVENT_LISTENER(previoustrack); |
| 50 DEFINE_ATTRIBUTE_EVENT_LISTENER(nexttrack); | 52 DEFINE_ATTRIBUTE_EVENT_LISTENER(nexttrack); |
| 51 DEFINE_ATTRIBUTE_EVENT_LISTENER(seekforward); | 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(seekforward); |
| 52 DEFINE_ATTRIBUTE_EVENT_LISTENER(seekbackward); | 54 DEFINE_ATTRIBUTE_EVENT_LISTENER(seekbackward); |
| 53 | 55 |
| 54 DECLARE_VIRTUAL_TRACE(); | 56 DECLARE_VIRTUAL_TRACE(); |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 friend class MediaSessionTest; | 59 friend class MediaSessionTest; |
| 58 | 60 |
| 59 explicit MediaSession(ExecutionContext*); | 61 explicit MediaSession(ExecutionContext*); |
| 60 | 62 |
| 61 // EventTarget overrides | 63 // EventTarget overrides |
| 62 bool addEventListenerInternal( | 64 bool addEventListenerInternal( |
| 63 const AtomicString& eventType, | 65 const AtomicString& eventType, |
| 64 EventListener*, | 66 EventListener*, |
| 65 const AddEventListenerOptionsResolved&) override; | 67 const AddEventListenerOptionsResolved&) override; |
| 66 bool removeEventListenerInternal(const AtomicString& eventType, | 68 bool removeEventListenerInternal(const AtomicString& eventType, |
| 67 const EventListener*, | 69 const EventListener*, |
| 68 const EventListenerOptions&) override; | 70 const EventListenerOptions&) override; |
| 69 | 71 |
| 70 // blink::mojom::blink::MediaSessionClient implementation. | 72 // blink::mojom::blink::MediaSessionClient implementation. |
| 71 void DidReceiveAction(blink::mojom::blink::MediaSessionAction) override; | 73 void DidReceiveAction(blink::mojom::blink::MediaSessionAction) override; |
| 72 | 74 |
| 73 // Returns null when the ExecutionContext is not document. | 75 // Returns null when the ExecutionContext is not document. |
| 74 mojom::blink::MediaSessionService* getService(); | 76 mojom::blink::MediaSessionService* getService(); |
| 75 | 77 |
| 78 mojom::blink::MediaSessionPlaybackState m_playbackState; |
| 76 Member<MediaMetadata> m_metadata; | 79 Member<MediaMetadata> m_metadata; |
| 77 mojom::blink::MediaSessionServicePtr m_service; | 80 mojom::blink::MediaSessionServicePtr m_service; |
| 78 mojo::Binding<blink::mojom::blink::MediaSessionClient> m_clientBinding; | 81 mojo::Binding<blink::mojom::blink::MediaSessionClient> m_clientBinding; |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 } // namespace blink | 84 } // namespace blink |
| 82 | 85 |
| 83 #endif // MediaSession_h | 86 #endif // MediaSession_h |
| OLD | NEW |