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

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

Issue 2355723004: [Presentation API] 1-UA: send message between controller and receiver page (Closed)
Patch Set: Merge with changes in Issue 2343013002 Created 4 years, 2 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // receiver.connectionList property not accessed 46 // receiver.connectionList property not accessed
47 if (!m_connectionListProperty) 47 if (!m_connectionListProperty)
48 return; 48 return;
49 49
50 if (m_connectionListProperty->getState() == ScriptPromisePropertyBase::Pendi ng) 50 if (m_connectionListProperty->getState() == ScriptPromisePropertyBase::Pendi ng)
51 m_connectionListProperty->resolve(m_connectionList); 51 m_connectionListProperty->resolve(m_connectionList);
52 else if (m_connectionListProperty->getState() == ScriptPromisePropertyBase:: Resolved) 52 else if (m_connectionListProperty->getState() == ScriptPromisePropertyBase:: Resolved)
53 m_connectionList->dispatchConnectionAvailableEvent(connection); 53 m_connectionList->dispatchConnectionAvailableEvent(connection);
54 } 54 }
55 55
56 void PresentationReceiver::didReceiveSessionTextMessage(WebPresentationConnectio nClient* connectionClient, const WebString& message)
57 {
58 std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connect ionClient);
59
60 PresentationConnection* connection = m_connectionList->findConnection(client .get());
61 if (!connection)
62 return;
63 connection->didReceiveTextMessage(message);
64 }
65
66 void PresentationReceiver::didReceiveSessionBinaryMessage(WebPresentationConnect ionClient* connectionClient, const uint8_t* data, size_t length)
67 {
68 std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connect ionClient);
69
70 PresentationConnection* connection = m_connectionList->findConnection(client .get());
71 if (!connection)
72 return;
73 connection->didReceiveBinaryMessage(data, length);
74 }
75
56 void PresentationReceiver::registerConnection(PresentationConnection* connection ) 76 void PresentationReceiver::registerConnection(PresentationConnection* connection )
57 { 77 {
58 DCHECK(m_connectionList); 78 DCHECK(m_connectionList);
59 m_connectionList->addConnection(connection); 79 m_connectionList->addConnection(connection);
60 } 80 }
61 81
62 DEFINE_TRACE(PresentationReceiver) 82 DEFINE_TRACE(PresentationReceiver)
63 { 83 {
64 visitor->trace(m_connectionList); 84 visitor->trace(m_connectionList);
65 visitor->trace(m_connectionListProperty); 85 visitor->trace(m_connectionListProperty);
66 DOMWindowProperty::trace(visitor); 86 DOMWindowProperty::trace(visitor);
67 } 87 }
68 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698