| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 WebPresentationConnection* PresentationReceiver::onReceiverConnectionAvailable( | 44 WebPresentationConnection* PresentationReceiver::onReceiverConnectionAvailable( |
| 45 const WebPresentationSessionInfo& sessionInfo) { | 45 const WebPresentationSessionInfo& sessionInfo) { |
| 46 // take() will call PresentationReceiver::registerConnection() | 46 // take() will call PresentationReceiver::registerConnection() |
| 47 // and register the connection. | 47 // and register the connection. |
| 48 auto connection = PresentationConnection::take(this, sessionInfo); | 48 auto connection = PresentationConnection::take(this, sessionInfo); |
| 49 | 49 |
| 50 // receiver.connectionList property not accessed | 50 // receiver.connectionList property not accessed |
| 51 if (!m_connectionListProperty) | 51 if (!m_connectionListProperty) |
| 52 return nullptr; | 52 return connection; |
| 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 return connection; | 62 return connection; |
| 62 } | 63 } |
| 63 | 64 |
| 64 void PresentationReceiver::registerConnection( | 65 void PresentationReceiver::registerConnection( |
| 65 PresentationConnection* connection) { | 66 PresentationConnection* connection) { |
| 66 DCHECK(m_connectionList); | 67 DCHECK(m_connectionList); |
| 67 m_connectionList->addConnection(connection); | 68 m_connectionList->addConnection(connection); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void PresentationReceiver::recordOriginTypeAccess(Document* document) const { | 71 void PresentationReceiver::recordOriginTypeAccess(Document* document) const { |
| 71 DCHECK(document); | 72 DCHECK(document); |
| 72 if (document->isSecureContext()) { | 73 if (document->isSecureContext()) { |
| 73 UseCounter::count(document, UseCounter::PresentationReceiverSecureOrigin); | 74 UseCounter::count(document, UseCounter::PresentationReceiverSecureOrigin); |
| 74 } else { | 75 } else { |
| 75 UseCounter::count(document, UseCounter::PresentationReceiverInsecureOrigin); | 76 UseCounter::count(document, UseCounter::PresentationReceiverInsecureOrigin); |
| 76 } | 77 } |
| 77 } | 78 } |
| 78 | 79 |
| 79 DEFINE_TRACE(PresentationReceiver) { | 80 DEFINE_TRACE(PresentationReceiver) { |
| 80 visitor->trace(m_connectionList); | 81 visitor->trace(m_connectionList); |
| 81 visitor->trace(m_connectionListProperty); | 82 visitor->trace(m_connectionListProperty); |
| 82 ContextClient::trace(visitor); | 83 ContextClient::trace(visitor); |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |