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

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

Issue 1092193003: [PresentationAPI] Added on-session-text-message handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Forward declare WebString in WebPresentationController.h Created 5 years, 7 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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