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