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

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: Revert "add typedef uint8_t for WIN32" 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/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
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
OLDNEW
« no previous file with comments | « Source/modules/presentation/Presentation.h ('k') | Source/modules/presentation/PresentationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698