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/PresentationSession.h" | 6 #include "modules/presentation/PresentationSession.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "core/dom/DOMArrayBuffer.h" | 9 #include "core/dom/DOMArrayBuffer.h" |
10 #include "core/dom/DOMArrayBufferView.h" | 10 #include "core/dom/DOMArrayBufferView.h" |
11 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
13 #include "core/events/Event.h" | 13 #include "core/events/Event.h" |
14 #include "core/events/MessageEvent.h" | 14 #include "core/events/MessageEvent.h" |
15 #include "core/fileapi/FileReaderLoader.h" | 15 #include "core/fileapi/FileReaderLoader.h" |
16 #include "core/fileapi/FileReaderLoaderClient.h" | 16 #include "core/fileapi/FileReaderLoaderClient.h" |
17 #include "core/frame/LocalFrame.h" | 17 #include "core/frame/LocalFrame.h" |
| 18 #include "core/frame/UseCounter.h" |
18 #include "modules/EventTargetModules.h" | 19 #include "modules/EventTargetModules.h" |
19 #include "modules/presentation/Presentation.h" | 20 #include "modules/presentation/Presentation.h" |
20 #include "modules/presentation/PresentationController.h" | 21 #include "modules/presentation/PresentationController.h" |
21 #include "modules/presentation/PresentationRequest.h" | 22 #include "modules/presentation/PresentationRequest.h" |
22 #include "modules/presentation/PresentationSessionConnectEvent.h" | 23 #include "modules/presentation/PresentationSessionConnectEvent.h" |
23 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" | 24 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" |
24 #include "wtf/Assertions.h" | 25 #include "wtf/Assertions.h" |
25 #include "wtf/OwnPtr.h" | 26 #include "wtf/OwnPtr.h" |
26 #include "wtf/text/AtomicString.h" | 27 #include "wtf/text/AtomicString.h" |
27 | 28 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 const AtomicString& PresentationSession::interfaceName() const | 151 const AtomicString& PresentationSession::interfaceName() const |
151 { | 152 { |
152 return EventTargetNames::PresentationSession; | 153 return EventTargetNames::PresentationSession; |
153 } | 154 } |
154 | 155 |
155 ExecutionContext* PresentationSession::executionContext() const | 156 ExecutionContext* PresentationSession::executionContext() const |
156 { | 157 { |
157 if (!frame()) | 158 if (!frame()) |
158 return nullptr; | 159 return nullptr; |
159 return frame()->document();} | 160 return frame()->document(); |
| 161 } |
| 162 |
| 163 bool PresentationSession::addEventListener(const AtomicString& eventType, PassRe
fPtrWillBeRawPtr<EventListener> listener, bool capture) |
| 164 { |
| 165 if (eventType == EventTypeNames::statechange) |
| 166 UseCounter::count(executionContext(), UseCounter::PresentationSessionSta
teChangeEventListener); |
| 167 else if (eventType == EventTypeNames::message) |
| 168 UseCounter::count(executionContext(), UseCounter::PresentationSessionMes
sageEventListener); |
| 169 |
| 170 return EventTarget::addEventListener(eventType, listener, capture); |
| 171 } |
160 | 172 |
161 DEFINE_TRACE(PresentationSession) | 173 DEFINE_TRACE(PresentationSession) |
162 { | 174 { |
163 visitor->trace(m_blobLoader); | 175 visitor->trace(m_blobLoader); |
164 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::tr
ace(visitor); | 176 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::tr
ace(visitor); |
165 DOMWindowProperty::trace(visitor); | 177 DOMWindowProperty::trace(visitor); |
166 } | 178 } |
167 | 179 |
168 const AtomicString& PresentationSession::state() const | 180 const AtomicString& PresentationSession::state() const |
169 { | 181 { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 { | 362 { |
351 ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob)
; | 363 ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob)
; |
352 // FIXME: generate error message? | 364 // FIXME: generate error message? |
353 // Ignore the current failed blob item and continue with next items. | 365 // Ignore the current failed blob item and continue with next items. |
354 m_messages.removeFirst(); | 366 m_messages.removeFirst(); |
355 m_blobLoader.clear(); | 367 m_blobLoader.clear(); |
356 handleMessageQueue(); | 368 handleMessageQueue(); |
357 } | 369 } |
358 | 370 |
359 } // namespace blink | 371 } // namespace blink |
OLD | NEW |