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 RemotePlaybackAvailability_h | 5 #ifndef RemotePlaybackAvailability_h |
6 #define RemotePlaybackAvailability_h | 6 #define RemotePlaybackAvailability_h |
7 | 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
8 #include "core/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
9 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class ExecutionContext; | 14 class ExecutionContext; |
14 class ScriptPromiseResolver; | 15 class ScriptPromiseResolver; |
15 | 16 |
16 // Expose whether there is a remote playback device available for a media | 17 // Expose whether there is a remote playback device available for a media |
17 // element. The object will be initialized with a default value passed via | 18 // element. The object will be initialized with a default value passed via |
18 // ::take() and will then listen to availability changes. | 19 // ::take() and will then listen to availability changes. |
19 class RemotePlaybackAvailability final : public EventTargetWithInlineData, publi
c ContextLifecycleObserver { | 20 class RemotePlaybackAvailability final |
| 21 : public EventTargetWithInlineData |
| 22 , public ActiveScriptWrappable |
| 23 , public ContextLifecycleObserver { |
20 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
21 USING_GARBAGE_COLLECTED_MIXIN(RemotePlaybackAvailability); | 25 USING_GARBAGE_COLLECTED_MIXIN(RemotePlaybackAvailability); |
22 public: | 26 public: |
23 static RemotePlaybackAvailability* take(ScriptPromiseResolver*, bool); | 27 static RemotePlaybackAvailability* take(ScriptPromiseResolver*, bool); |
24 ~RemotePlaybackAvailability() override; | 28 ~RemotePlaybackAvailability() override; |
25 | 29 |
26 // EventTarget implementation. | 30 // EventTarget implementation. |
27 const AtomicString& interfaceName() const override; | 31 const AtomicString& interfaceName() const override; |
28 ExecutionContext* getExecutionContext() const override; | 32 ExecutionContext* getExecutionContext() const override; |
29 | 33 |
30 void availabilityChanged(bool); | 34 void availabilityChanged(bool); |
31 | 35 |
32 bool value() const; | 36 bool value() const; |
33 | 37 |
| 38 // ActiveScriptWrappable implementation. |
| 39 bool hasPendingActivity() const final; |
| 40 |
34 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | 41 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
35 | 42 |
36 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
37 | 44 |
38 private: | 45 private: |
39 RemotePlaybackAvailability(ExecutionContext*, bool); | 46 RemotePlaybackAvailability(ExecutionContext*, bool); |
40 | 47 |
41 bool m_value; | 48 bool m_value; |
42 }; | 49 }; |
43 | 50 |
44 } // namespace blink | 51 } // namespace blink |
45 | 52 |
46 #endif // RemotePlaybackAvailability_h | 53 #endif // RemotePlaybackAvailability_h |
OLD | NEW |