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