| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/presentation/PresentationAvailability.h" | 6 #include "modules/presentation/PresentationAvailability.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/events/Event.h" | 10 #include "core/events/Event.h" |
| 11 #include "core/frame/UseCounter.h" |
| 11 #include "modules/EventTargetModulesNames.h" | 12 #include "modules/EventTargetModulesNames.h" |
| 12 #include "modules/presentation/PresentationController.h" | 13 #include "modules/presentation/PresentationController.h" |
| 13 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
| 14 #include "public/platform/modules/presentation/WebPresentationClient.h" | 15 #include "public/platform/modules/presentation/WebPresentationClient.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 WebPresentationClient* presentationClient(ExecutionContext* executionContext) | 21 WebPresentationClient* presentationClient(ExecutionContext* executionContext) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const AtomicString& PresentationAvailability::interfaceName() const | 56 const AtomicString& PresentationAvailability::interfaceName() const |
| 56 { | 57 { |
| 57 return EventTargetNames::PresentationAvailability; | 58 return EventTargetNames::PresentationAvailability; |
| 58 } | 59 } |
| 59 | 60 |
| 60 ExecutionContext* PresentationAvailability::executionContext() const | 61 ExecutionContext* PresentationAvailability::executionContext() const |
| 61 { | 62 { |
| 62 return ActiveDOMObject::executionContext(); | 63 return ActiveDOMObject::executionContext(); |
| 63 } | 64 } |
| 64 | 65 |
| 66 bool PresentationAvailability::addEventListener(const AtomicString& eventType, P
assRefPtrWillBeRawPtr<EventListener> listener, bool capture) |
| 67 { |
| 68 if (eventType == EventTypeNames::change) |
| 69 UseCounter::count(executionContext(), UseCounter::PresentationAvailabili
tyChangeEventListener); |
| 70 |
| 71 return EventTarget::addEventListener(eventType, listener, capture); |
| 72 } |
| 73 |
| 65 void PresentationAvailability::availabilityChanged(bool value) | 74 void PresentationAvailability::availabilityChanged(bool value) |
| 66 { | 75 { |
| 67 if (m_value == value) | 76 if (m_value == value) |
| 68 return; | 77 return; |
| 69 | 78 |
| 70 m_value = value; | 79 m_value = value; |
| 71 dispatchEvent(Event::create(EventTypeNames::change)); | 80 dispatchEvent(Event::create(EventTypeNames::change)); |
| 72 } | 81 } |
| 73 | 82 |
| 74 bool PresentationAvailability::hasPendingActivity() const | 83 bool PresentationAvailability::hasPendingActivity() const |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 129 } |
| 121 | 130 |
| 122 DEFINE_TRACE(PresentationAvailability) | 131 DEFINE_TRACE(PresentationAvailability) |
| 123 { | 132 { |
| 124 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAvailability
>::trace(visitor); | 133 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAvailability
>::trace(visitor); |
| 125 PageLifecycleObserver::trace(visitor); | 134 PageLifecycleObserver::trace(visitor); |
| 126 ActiveDOMObject::trace(visitor); | 135 ActiveDOMObject::trace(visitor); |
| 127 } | 136 } |
| 128 | 137 |
| 129 } // namespace | 138 } // namespace |
| OLD | NEW |