OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/PresentationReceiver.h" | 5 #include "modules/presentation/PresentationReceiver.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 return m_connectionListProperty->promise(scriptState->world()); | 39 return m_connectionListProperty->promise(scriptState->world()); |
40 } | 40 } |
41 | 41 |
42 void PresentationReceiver::onReceiverConnectionAvailable( | 42 void PresentationReceiver::onReceiverConnectionAvailable( |
43 WebPresentationConnectionClient* connectionClient) { | 43 WebPresentationConnectionClient* connectionClient) { |
44 DCHECK(connectionClient); | 44 DCHECK(connectionClient); |
45 // take() will call PresentationReceiver::registerConnection() | 45 // take() will call PresentationReceiver::registerConnection() |
46 // and register the connection. | 46 // and register the connection. |
47 auto connection = | 47 auto connection = |
48 PresentationConnection::take(this, wrapUnique(connectionClient)); | 48 PresentationConnection::take(this, WTF::wrapUnique(connectionClient)); |
49 | 49 |
50 // receiver.connectionList property not accessed | 50 // receiver.connectionList property not accessed |
51 if (!m_connectionListProperty) | 51 if (!m_connectionListProperty) |
52 return; | 52 return; |
53 | 53 |
54 if (m_connectionListProperty->getState() == | 54 if (m_connectionListProperty->getState() == |
55 ScriptPromisePropertyBase::Pending) | 55 ScriptPromisePropertyBase::Pending) |
56 m_connectionListProperty->resolve(m_connectionList); | 56 m_connectionListProperty->resolve(m_connectionList); |
57 else if (m_connectionListProperty->getState() == | 57 else if (m_connectionListProperty->getState() == |
58 ScriptPromisePropertyBase::Resolved) | 58 ScriptPromisePropertyBase::Resolved) |
59 m_connectionList->dispatchConnectionAvailableEvent(connection); | 59 m_connectionList->dispatchConnectionAvailableEvent(connection); |
60 } | 60 } |
61 | 61 |
62 void PresentationReceiver::registerConnection( | 62 void PresentationReceiver::registerConnection( |
63 PresentationConnection* connection) { | 63 PresentationConnection* connection) { |
64 DCHECK(m_connectionList); | 64 DCHECK(m_connectionList); |
65 m_connectionList->addConnection(connection); | 65 m_connectionList->addConnection(connection); |
66 } | 66 } |
67 | 67 |
68 DEFINE_TRACE(PresentationReceiver) { | 68 DEFINE_TRACE(PresentationReceiver) { |
69 visitor->trace(m_connectionList); | 69 visitor->trace(m_connectionList); |
70 visitor->trace(m_connectionListProperty); | 70 visitor->trace(m_connectionListProperty); |
71 DOMWindowProperty::trace(visitor); | 71 DOMWindowProperty::trace(visitor); |
72 } | 72 } |
73 } // namespace blink | 73 } // namespace blink |
OLD | NEW |