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