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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 void Presentation::didChangeSessionState(WebPresentationSessionClient* sessionCl
ient, WebPresentationSessionState sessionState) | 155 void Presentation::didChangeSessionState(WebPresentationSessionClient* sessionCl
ient, WebPresentationSessionState sessionState) |
156 { | 156 { |
157 PresentationSession* session = findSession(sessionClient); | 157 PresentationSession* session = findSession(sessionClient); |
158 if (session) | 158 if (session) |
159 session->didChangeState(sessionState); | 159 session->didChangeState(sessionState); |
160 | 160 |
161 PresentationSession::dispose(sessionClient); | 161 PresentationSession::dispose(sessionClient); |
162 } | 162 } |
163 | 163 |
| 164 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se
ssionClient, const String& message) |
| 165 { |
| 166 PresentationSession* session = findSession(sessionClient); |
| 167 if (session) |
| 168 session->didReceiveTextMessage(message); |
| 169 |
| 170 PresentationSession::dispose(sessionClient); |
| 171 } |
| 172 |
164 void Presentation::registerSession(PresentationSession* session) | 173 void Presentation::registerSession(PresentationSession* session) |
165 { | 174 { |
166 m_openSessions.add(session); | 175 m_openSessions.add(session); |
167 } | 176 } |
168 | 177 |
169 PresentationController* Presentation::presentationController() | 178 PresentationController* Presentation::presentationController() |
170 { | 179 { |
171 if (!frame()) | 180 if (!frame()) |
172 return nullptr; | 181 return nullptr; |
173 return PresentationController::from(*frame()); | 182 return PresentationController::from(*frame()); |
174 } | 183 } |
175 | 184 |
176 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses
sionClient) | 185 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses
sionClient) |
177 { | 186 { |
178 for (const auto& session : m_openSessions) { | 187 for (const auto& session : m_openSessions) { |
179 if (session->matches(sessionClient)) | 188 if (session->matches(sessionClient)) |
180 return session.get(); | 189 return session.get(); |
181 } | 190 } |
182 return nullptr; | 191 return nullptr; |
183 } | 192 } |
184 | 193 |
185 } // namespace blink | 194 } // namespace blink |
OLD | NEW |