| 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 #include "modules/remoteplayback/RemotePlaybackAvailability.h" | 5 #include "modules/remoteplayback/RemotePlaybackAvailability.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/events/Event.h" | 9 #include "core/events/Event.h" |
| 10 #include "modules/EventTargetModulesNames.h" | 10 #include "modules/EventTargetModulesNames.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 RemotePlaybackAvailability* RemotePlaybackAvailability::take(ScriptPromiseResolv
er* resolver, bool value) | 15 RemotePlaybackAvailability* RemotePlaybackAvailability::take(ScriptPromiseResolv
er* resolver, bool value) |
| 16 { | 16 { |
| 17 return new RemotePlaybackAvailability(resolver->getExecutionContext(), value
); | 17 return new RemotePlaybackAvailability(resolver->getExecutionContext(), value
); |
| 18 } | 18 } |
| 19 | 19 |
| 20 RemotePlaybackAvailability::RemotePlaybackAvailability(ExecutionContext* executi
onContext, bool value) | 20 RemotePlaybackAvailability::RemotePlaybackAvailability(ExecutionContext* executi
onContext, bool value) |
| 21 : ContextLifecycleObserver(executionContext) | 21 : ActiveScriptWrappable(this) |
| 22 , ContextLifecycleObserver(executionContext) |
| 22 , m_value(value) | 23 , m_value(value) |
| 23 { | 24 { |
| 24 ASSERT(executionContext->isDocument()); | 25 ASSERT(executionContext->isDocument()); |
| 25 } | 26 } |
| 26 | 27 |
| 27 RemotePlaybackAvailability::~RemotePlaybackAvailability() = default; | 28 RemotePlaybackAvailability::~RemotePlaybackAvailability() = default; |
| 28 | 29 |
| 29 const AtomicString& RemotePlaybackAvailability::interfaceName() const | 30 const AtomicString& RemotePlaybackAvailability::interfaceName() const |
| 30 { | 31 { |
| 31 return EventTargetNames::RemotePlaybackAvailability; | 32 return EventTargetNames::RemotePlaybackAvailability; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 m_value = value; | 45 m_value = value; |
| 45 dispatchEvent(Event::create(EventTypeNames::change)); | 46 dispatchEvent(Event::create(EventTypeNames::change)); |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool RemotePlaybackAvailability::value() const | 49 bool RemotePlaybackAvailability::value() const |
| 49 { | 50 { |
| 50 return m_value; | 51 return m_value; |
| 51 } | 52 } |
| 52 | 53 |
| 54 bool RemotePlaybackAvailability::hasPendingActivity() const |
| 55 { |
| 56 return hasEventListeners(); |
| 57 } |
| 58 |
| 53 DEFINE_TRACE(RemotePlaybackAvailability) | 59 DEFINE_TRACE(RemotePlaybackAvailability) |
| 54 { | 60 { |
| 55 EventTargetWithInlineData::trace(visitor); | 61 EventTargetWithInlineData::trace(visitor); |
| 56 ContextLifecycleObserver::trace(visitor); | 62 ContextLifecycleObserver::trace(visitor); |
| 57 } | 63 } |
| 58 | 64 |
| 59 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |