Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: third_party/WebKit/Source/modules/mediasession/MediaSession.h

Issue 2426653002: Adding mojo MediaSessionClient to support media controls (Closed)
Patch Set: addressed Anton's comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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();
haraken 2016/10/17 22:37:05 You need to add USING_PRE_FINALIZER and clear m_cl
Zhiqiang Zhang (Slow) 2016/10/18 14:42:14 Thanks! Done.
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;
31 ExecutionContext* getExecutionContext() const override; 34 ExecutionContext* getExecutionContext() const override;
(...skipping 15 matching lines...) Expand all
47 50
48 // EventTarget overrides 51 // EventTarget overrides
49 bool addEventListenerInternal( 52 bool addEventListenerInternal(
50 const AtomicString& eventType, 53 const AtomicString& eventType,
51 EventListener*, 54 EventListener*,
52 const AddEventListenerOptionsResolved&) override; 55 const AddEventListenerOptionsResolved&) override;
53 bool removeEventListenerInternal(const AtomicString& eventType, 56 bool removeEventListenerInternal(const AtomicString& eventType,
54 const EventListener*, 57 const EventListener*,
55 const EventListenerOptions&) override; 58 const EventListenerOptions&) override;
56 59
60 // blink::mojom::blink::MediaSessionClient implementation.
61 void DidReceivedAction(blink::mojom::blink::MediaSessionAction) override;
62
57 // Returns null when the ExecutionContext is not document. 63 // Returns null when the ExecutionContext is not document.
58 mojom::blink::MediaSessionService* getService(ScriptState*); 64 mojom::blink::MediaSessionService* getService(ScriptState*);
59 65
60 RefPtr<ScriptState> m_scriptState; 66 RefPtr<ScriptState> m_scriptState;
61 Member<MediaMetadata> m_metadata; 67 Member<MediaMetadata> m_metadata;
62 mojom::blink::MediaSessionServicePtr m_service; 68 mojom::blink::MediaSessionServicePtr m_service;
69 mojo::Binding<blink::mojom::blink::MediaSessionClient> m_clientBinding;
63 }; 70 };
64 71
65 } // namespace blink 72 } // namespace blink
66 73
67 #endif // MediaSession_h 74 #endif // MediaSession_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698