Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp

Issue 2737413003: [Presentation API] Remove references to presentation sessions. (Closed)
Patch Set: Update PresentationServiceDelegateImpl unittest Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 36
37 if (!m_connectionList->isEmpty() && 37 if (!m_connectionList->isEmpty() &&
38 m_connectionListProperty->getState() == 38 m_connectionListProperty->getState() ==
39 ScriptPromisePropertyBase::Pending) 39 ScriptPromisePropertyBase::Pending)
40 m_connectionListProperty->resolve(m_connectionList); 40 m_connectionListProperty->resolve(m_connectionList);
41 41
42 return m_connectionListProperty->promise(scriptState->world()); 42 return m_connectionListProperty->promise(scriptState->world());
43 } 43 }
44 44
45 WebPresentationConnection* PresentationReceiver::onReceiverConnectionAvailable( 45 WebPresentationConnection* PresentationReceiver::onReceiverConnectionAvailable(
46 const WebPresentationSessionInfo& sessionInfo) { 46 const WebPresentationInfo& presentationInfo) {
47 // take() will call PresentationReceiver::registerConnection() 47 // take() will call PresentationReceiver::registerConnection()
48 // and register the connection. 48 // and register the connection.
49 auto connection = PresentationConnection::take(this, sessionInfo); 49 auto connection = PresentationConnection::take(this, presentationInfo);
50 50
51 // receiver.connectionList property not accessed 51 // receiver.connectionList property not accessed
52 if (!m_connectionListProperty) 52 if (!m_connectionListProperty)
53 return connection; 53 return connection;
54 54
55 if (m_connectionListProperty->getState() == 55 if (m_connectionListProperty->getState() ==
56 ScriptPromisePropertyBase::Pending) { 56 ScriptPromisePropertyBase::Pending) {
57 m_connectionListProperty->resolve(m_connectionList); 57 m_connectionListProperty->resolve(m_connectionList);
58 } else if (m_connectionListProperty->getState() == 58 } else if (m_connectionListProperty->getState() ==
59 ScriptPromisePropertyBase::Resolved) { 59 ScriptPromisePropertyBase::Resolved) {
60 m_connectionList->dispatchConnectionAvailableEvent(connection); 60 m_connectionList->dispatchConnectionAvailableEvent(connection);
61 } 61 }
62 62
63 return connection; 63 return connection;
64 } 64 }
65 65
66 void PresentationReceiver::didChangeSessionState( 66 void PresentationReceiver::didChangeConnectionState(
67 WebPresentationConnectionState state) { 67 WebPresentationConnectionState state) {
68 // TODO(zhaobin): remove or modify DCHECK when receiver supports more 68 // TODO(zhaobin): remove or modify DCHECK when receiver supports more
69 // connection state change. 69 // connection state change.
70 DCHECK(state == WebPresentationConnectionState::Terminated); 70 DCHECK(state == WebPresentationConnectionState::Terminated);
71 71
72 for (auto connection : m_connectionList->connections()) 72 for (auto connection : m_connectionList->connections())
73 connection->didChangeState(state, false /* shouldDispatchEvent */); 73 connection->didChangeState(state, false /* shouldDispatchEvent */);
74 } 74 }
75 75
76 void PresentationReceiver::terminateConnection() { 76 void PresentationReceiver::terminateConnection() {
(...skipping 22 matching lines...) Expand all
99 } 99 }
100 } 100 }
101 101
102 DEFINE_TRACE(PresentationReceiver) { 102 DEFINE_TRACE(PresentationReceiver) {
103 visitor->trace(m_connectionList); 103 visitor->trace(m_connectionList);
104 visitor->trace(m_connectionListProperty); 104 visitor->trace(m_connectionListProperty);
105 ContextClient::trace(visitor); 105 ContextClient::trace(visitor);
106 } 106 }
107 107
108 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698