| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/presentation/PresentationAvailability.h" | 5 #include "modules/presentation/PresentationAvailability.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 "core/frame/UseCounter.h" | 10 #include "core/frame/UseCounter.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 presentationAvailability->suspendIfNeeded(); | 41 presentationAvailability->suspendIfNeeded(); |
| 42 presentationAvailability->updateListening(); | 42 presentationAvailability->updateListening(); |
| 43 return presentationAvailability; | 43 return presentationAvailability; |
| 44 } | 44 } |
| 45 | 45 |
| 46 PresentationAvailability::PresentationAvailability( | 46 PresentationAvailability::PresentationAvailability( |
| 47 ExecutionContext* executionContext, | 47 ExecutionContext* executionContext, |
| 48 const KURL& url, | 48 const KURL& url, |
| 49 bool value) | 49 bool value) |
| 50 : ActiveScriptWrappable(this), | 50 : ActiveScriptWrappable(this), |
| 51 ActiveDOMObject(executionContext), | 51 SuspendableObject(executionContext), |
| 52 PageVisibilityObserver(toDocument(executionContext)->page()), | 52 PageVisibilityObserver(toDocument(executionContext)->page()), |
| 53 m_url(url), | 53 m_url(url), |
| 54 m_value(value), | 54 m_value(value), |
| 55 m_state(State::Active) { | 55 m_state(State::Active) { |
| 56 ASSERT(executionContext->isDocument()); | 56 ASSERT(executionContext->isDocument()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 PresentationAvailability::~PresentationAvailability() {} | 59 PresentationAvailability::~PresentationAvailability() {} |
| 60 | 60 |
| 61 const AtomicString& PresentationAvailability::interfaceName() const { | 61 const AtomicString& PresentationAvailability::interfaceName() const { |
| 62 return EventTargetNames::PresentationAvailability; | 62 return EventTargetNames::PresentationAvailability; |
| 63 } | 63 } |
| 64 | 64 |
| 65 ExecutionContext* PresentationAvailability::getExecutionContext() const { | 65 ExecutionContext* PresentationAvailability::getExecutionContext() const { |
| 66 return ActiveDOMObject::getExecutionContext(); | 66 return SuspendableObject::getExecutionContext(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void PresentationAvailability::addedEventListener( | 69 void PresentationAvailability::addedEventListener( |
| 70 const AtomicString& eventType, | 70 const AtomicString& eventType, |
| 71 RegisteredEventListener& registeredListener) { | 71 RegisteredEventListener& registeredListener) { |
| 72 EventTargetWithInlineData::addedEventListener(eventType, registeredListener); | 72 EventTargetWithInlineData::addedEventListener(eventType, registeredListener); |
| 73 if (eventType == EventTypeNames::change) | 73 if (eventType == EventTypeNames::change) |
| 74 UseCounter::count(getExecutionContext(), | 74 UseCounter::count(getExecutionContext(), |
| 75 UseCounter::PresentationAvailabilityChangeEventListener); | 75 UseCounter::PresentationAvailabilityChangeEventListener); |
| 76 } | 76 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return WebURL(m_url); | 127 return WebURL(m_url); |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool PresentationAvailability::value() const { | 130 bool PresentationAvailability::value() const { |
| 131 return m_value; | 131 return m_value; |
| 132 } | 132 } |
| 133 | 133 |
| 134 DEFINE_TRACE(PresentationAvailability) { | 134 DEFINE_TRACE(PresentationAvailability) { |
| 135 EventTargetWithInlineData::trace(visitor); | 135 EventTargetWithInlineData::trace(visitor); |
| 136 PageVisibilityObserver::trace(visitor); | 136 PageVisibilityObserver::trace(visitor); |
| 137 ActiveDOMObject::trace(visitor); | 137 SuspendableObject::trace(visitor); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |