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/Presentation.h" | 6 #include "modules/presentation/Presentation.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se
ssionClient, const String& message) | 146 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se
ssionClient, const String& message) |
147 { | 147 { |
148 PresentationSession* session = findSession(sessionClient); | 148 PresentationSession* session = findSession(sessionClient); |
149 if (session) | 149 if (session) |
150 session->didReceiveTextMessage(message); | 150 session->didReceiveTextMessage(message); |
151 | 151 |
152 delete sessionClient; | 152 delete sessionClient; |
153 } | 153 } |
154 | 154 |
| 155 void Presentation::didReceiveSessionBinaryMessage(WebPresentationSessionClient*
sessionClient, const uint8_t* data, size_t length) |
| 156 { |
| 157 PresentationSession* session = findSession(sessionClient); |
| 158 if (session) |
| 159 session->didReceiveBinaryMessage(data, length); |
| 160 |
| 161 delete sessionClient; |
| 162 } |
| 163 |
155 void Presentation::registerSession(PresentationSession* session) | 164 void Presentation::registerSession(PresentationSession* session) |
156 { | 165 { |
157 m_openSessions.add(session); | 166 m_openSessions.add(session); |
158 } | 167 } |
159 | 168 |
160 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses
sionClient) | 169 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses
sionClient) |
161 { | 170 { |
162 for (const auto& session : m_openSessions) { | 171 for (const auto& session : m_openSessions) { |
163 if (session->matches(sessionClient)) | 172 if (session->matches(sessionClient)) |
164 return session.get(); | 173 return session.get(); |
165 } | 174 } |
166 return nullptr; | 175 return nullptr; |
167 } | 176 } |
168 | 177 |
169 } // namespace blink | 178 } // namespace blink |
OLD | NEW |