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

Side by Side Diff: Source/modules/presentation/Presentation.cpp

Issue 1206513004: [PresentationAPI] on-session-message handler for binary messages (Blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased. layout test update. Created 5 years, 5 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 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
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::didReceiveSessionBinaryMessage(WebPresentationSessionClient* sessionClient, const uint8_t* data, size_t length)
174 {
175 PresentationSession* session = findSession(sessionClient);
176 if (session)
177 session->didReceiveBinaryMessage(data, length);
178
179 PresentationSession::dispose(sessionClient);
mark a. foltz 2015/07/06 21:19:45 This method will be going away soon; see https://c
USE s.singapati at gmail.com 2015/07/07 15:00:33 Done.
180 }
181
173 void Presentation::registerSession(PresentationSession* session) 182 void Presentation::registerSession(PresentationSession* session)
174 { 183 {
175 m_openSessions.add(session); 184 m_openSessions.add(session);
176 } 185 }
177 186
178 PresentationController* Presentation::presentationController() 187 PresentationController* Presentation::presentationController()
179 { 188 {
180 if (!frame()) 189 if (!frame())
181 return nullptr; 190 return nullptr;
182 return PresentationController::from(*frame()); 191 return PresentationController::from(*frame());
183 } 192 }
184 193
185 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses sionClient) 194 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses sionClient)
186 { 195 {
187 for (const auto& session : m_openSessions) { 196 for (const auto& session : m_openSessions) {
188 if (session->matches(sessionClient)) 197 if (session->matches(sessionClient))
189 return session.get(); 198 return session.get();
190 } 199 }
191 return nullptr; 200 return nullptr;
192 } 201 }
193 202
194 } // namespace blink 203 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698