OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 RemotePlayback_h | 5 #ifndef RemotePlayback_h |
6 #define RemotePlayback_h | 6 #define RemotePlayback_h |
7 | 7 |
8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| 11 #include "modules/ModulesExport.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 13 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
13 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" | 14 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" |
| 15 #include "wtf/Compiler.h" |
14 #include "wtf/text/AtomicString.h" | 16 #include "wtf/text/AtomicString.h" |
15 #include "wtf/text/WTFString.h" | 17 #include "wtf/text/WTFString.h" |
16 | 18 |
17 namespace blink { | 19 namespace blink { |
18 | 20 |
19 class ExecutionContext; | 21 class ExecutionContext; |
20 class HTMLMediaElement; | 22 class HTMLMediaElement; |
21 class LocalFrame; | 23 class LocalFrame; |
22 class RemotePlaybackAvailability; | 24 class RemotePlaybackAvailability; |
23 class ScriptPromiseResolver; | 25 class ScriptPromiseResolver; |
24 | 26 |
25 class RemotePlayback final : public EventTargetWithInlineData, | 27 class MODULES_EXPORT RemotePlayback final |
26 public ActiveScriptWrappable, | 28 : public EventTargetWithInlineData, |
27 private WebRemotePlaybackClient { | 29 public ActiveScriptWrappable, |
| 30 WTF_NON_EXPORTED_BASE(private WebRemotePlaybackClient) { |
28 DEFINE_WRAPPERTYPEINFO(); | 31 DEFINE_WRAPPERTYPEINFO(); |
29 USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback); | 32 USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback); |
30 | 33 |
31 public: | 34 public: |
32 static RemotePlayback* create(HTMLMediaElement&); | 35 static RemotePlayback* create(HTMLMediaElement&); |
33 | 36 |
34 // EventTarget implementation. | 37 // EventTarget implementation. |
35 const WTF::AtomicString& interfaceName() const override; | 38 const WTF::AtomicString& interfaceName() const override; |
36 ExecutionContext* getExecutionContext() const override; | 39 ExecutionContext* getExecutionContext() const override; |
37 | 40 |
38 ScriptPromise getAvailability(ScriptState*); | 41 ScriptPromise getAvailability(ScriptState*); |
39 ScriptPromise prompt(ScriptState*); | 42 ScriptPromise prompt(ScriptState*); |
40 | 43 |
41 String state() const; | 44 String state() const; |
42 | 45 |
43 // ScriptWrappable implementation. | 46 // ScriptWrappable implementation. |
44 bool hasPendingActivity() const final; | 47 bool hasPendingActivity() const final; |
45 | 48 |
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
47 | 50 |
48 DECLARE_VIRTUAL_TRACE(); | 51 DECLARE_VIRTUAL_TRACE(); |
49 | 52 |
50 private: | 53 private: |
| 54 friend class RemotePlaybackTest; |
| 55 |
51 explicit RemotePlayback(HTMLMediaElement&); | 56 explicit RemotePlayback(HTMLMediaElement&); |
52 | 57 |
53 // WebRemotePlaybackClient implementation. | 58 // WebRemotePlaybackClient implementation. |
54 void stateChanged(WebRemotePlaybackState) override; | 59 void stateChanged(WebRemotePlaybackState) override; |
55 void availabilityChanged(bool available) override; | 60 void availabilityChanged(bool available) override; |
56 void promptCancelled() override; | 61 void promptCancelled() override; |
57 | 62 |
58 WebRemotePlaybackState m_state; | 63 WebRemotePlaybackState m_state; |
59 bool m_availability; | 64 bool m_availability; |
60 HeapVector<Member<RemotePlaybackAvailability>> m_availabilityObjects; | 65 HeapVector<Member<RemotePlaybackAvailability>> m_availabilityObjects; |
61 Member<HTMLMediaElement> m_mediaElement; | 66 Member<HTMLMediaElement> m_mediaElement; |
62 Member<ScriptPromiseResolver> m_promptPromiseResolver; | 67 Member<ScriptPromiseResolver> m_promptPromiseResolver; |
63 }; | 68 }; |
64 | 69 |
65 } // namespace blink | 70 } // namespace blink |
66 | 71 |
67 #endif // RemotePlayback_h | 72 #endif // RemotePlayback_h |
OLD | NEW |