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/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se
ssionClient, const String& message) | 164 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se
ssionClient, const String& message) |
165 { | 165 { |
166 PresentationSession* session = findSession(sessionClient); | 166 PresentationSession* session = findSession(sessionClient); |
167 if (session) | 167 if (session) |
168 session->didReceiveTextMessage(message); | 168 session->didReceiveTextMessage(message); |
169 | 169 |
170 PresentationSession::dispose(sessionClient); | 170 PresentationSession::dispose(sessionClient); |
171 } | 171 } |
172 | 172 |
| 173 void Presentation::didReceiveSessionArrayBufferMessage(WebPresentationSessionCli
ent* sessionClient, const uint8_t* data, size_t length) |
| 174 { |
| 175 PresentationSession* session = findSession(sessionClient); |
| 176 if (session) |
| 177 session->didReceiveArrayBufferMessage(data, length); |
| 178 |
| 179 PresentationSession::dispose(sessionClient); |
| 180 } |
| 181 |
| 182 void Presentation::didReceiveSessionBlobMessage(WebPresentationSessionClient* se
ssionClient, const uint8_t* data, size_t length) |
| 183 { |
| 184 PresentationSession* session = findSession(sessionClient); |
| 185 if (session) |
| 186 session->didReceiveBlobMessage(data, length); |
| 187 |
| 188 PresentationSession::dispose(sessionClient); |
| 189 } |
| 190 |
173 void Presentation::registerSession(PresentationSession* session) | 191 void Presentation::registerSession(PresentationSession* session) |
174 { | 192 { |
175 m_openSessions.add(session); | 193 m_openSessions.add(session); |
176 } | 194 } |
177 | 195 |
178 PresentationController* Presentation::presentationController() | 196 PresentationController* Presentation::presentationController() |
179 { | 197 { |
180 if (!frame()) | 198 if (!frame()) |
181 return nullptr; | 199 return nullptr; |
182 return PresentationController::from(*frame()); | 200 return PresentationController::from(*frame()); |
183 } | 201 } |
184 | 202 |
185 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses
sionClient) | 203 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses
sionClient) |
186 { | 204 { |
187 for (const auto& session : m_openSessions) { | 205 for (const auto& session : m_openSessions) { |
188 if (session->matches(sessionClient)) | 206 if (session->matches(sessionClient)) |
189 return session.get(); | 207 return session.get(); |
190 } | 208 } |
191 return nullptr; | 209 return nullptr; |
192 } | 210 } |
193 | 211 |
194 } // namespace blink | 212 } // namespace blink |
OLD | NEW |