Chromium Code Reviews| Index: third_party/WebKit/Source/modules/mediasession/MediaSession.h |
| diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.h b/third_party/WebKit/Source/modules/mediasession/MediaSession.h |
| index 458f5e08176311857709797ef6f7e2b0d8d3786b..004edd1c01126ff8098dfcbe37db8591e485603a 100644 |
| --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.h |
| +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.h |
| @@ -6,6 +6,7 @@ |
| #define MediaSession_h |
| #include "bindings/core/v8/ScriptWrappable.h" |
| +#include "core/events/EventTarget.h" |
| #include "modules/ModulesExport.h" |
| #include "platform/heap/Handle.h" |
| #include "public/platform/modules/mediasession/media_session.mojom-blink.h" |
| @@ -16,27 +17,48 @@ namespace blink { |
| class MediaMetadata; |
| class ScriptState; |
| -class MODULES_EXPORT MediaSession final |
| - : public GarbageCollectedFinalized<MediaSession>, |
| - public ScriptWrappable { |
| +class MODULES_EXPORT MediaSession final : public EventTargetWithInlineData { |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - static MediaSession* create(); |
| + static MediaSession* create(ScriptState*); |
| - void setMetadata(ScriptState*, MediaMetadata*); |
| - MediaMetadata* metadata(ScriptState*) const; |
| + void setMetadata(MediaMetadata*); |
| + MediaMetadata* metadata() const; |
| + |
| + // EventTarget implementation. |
| + const WTF::AtomicString& interfaceName() const override; |
| + ExecutionContext* getExecutionContext() const override; |
| + |
| + // Event getters and setters. Not using DEFINE_ATTRIBUTE_EVENT_LISTENER macro |
|
whywhat
2016/10/17 15:32:35
I thought the common way to do it was to override
whywhat
2016/10/17 15:41:46
s/attachEventListener/addEventListener
Zhiqiang Zhang (Slow)
2016/10/17 17:19:08
Thanks. Done.
Though there might be a drawback whe
whywhat
2016/10/17 17:32:06
That's already the case with add/removeEventListen
|
| + // since there are additional actions in setters. |
| + EventListener* onplay(); |
| + EventListener* onpause(); |
| + EventListener* onplaypause(); |
| + EventListener* onprevioustrack(); |
| + EventListener* onnexttrack(); |
| + EventListener* onseekforward(); |
| + EventListener* onseekbackward(); |
| + |
| + void setOnplay(EventListener*); |
| + void setOnpause(EventListener*); |
| + void setOnplaypause(EventListener*); |
| + void setOnprevioustrack(EventListener*); |
| + void setOnnexttrack(EventListener*); |
| + void setOnseekforward(EventListener*); |
| + void setOnseekbackward(EventListener*); |
| DECLARE_VIRTUAL_TRACE(); |
| private: |
| friend class MediaSessionTest; |
| - MediaSession(); |
| + MediaSession(ScriptState*); |
| // Returns null when the ExecutionContext is not document. |
| mojom::blink::MediaSessionService* getService(ScriptState*); |
| + RefPtr<ScriptState> m_scriptState; |
| Member<MediaMetadata> m_metadata; |
| mojom::blink::MediaSessionServicePtr m_service; |
| }; |