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

Side by Side Diff: Source/modules/presentation/PresentationSession.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/PresentationSession.h" 6 #include "modules/presentation/PresentationSession.h"
7 7
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/DOMArrayBufferView.h" 9 #include "core/dom/DOMArrayBufferView.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/events/Event.h" 12 #include "core/events/Event.h"
13 #include "core/events/MessageEvent.h"
13 #include "core/frame/LocalFrame.h" 14 #include "core/frame/LocalFrame.h"
14 #include "modules/EventTargetModules.h" 15 #include "modules/EventTargetModules.h"
15 #include "modules/presentation/Presentation.h" 16 #include "modules/presentation/Presentation.h"
16 #include "modules/presentation/PresentationController.h" 17 #include "modules/presentation/PresentationController.h"
17 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" 18 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
18 #include "wtf/Assertions.h" 19 #include "wtf/Assertions.h"
19 #include "wtf/OwnPtr.h" 20 #include "wtf/OwnPtr.h"
20 #include "wtf/text/AtomicString.h" 21 #include "wtf/text/AtomicString.h"
21 22
22 namespace blink { 23 namespace blink {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (m_state == WebPresentationSessionState::Disconnected) { 129 if (m_state == WebPresentationSessionState::Disconnected) {
129 throwPresentationDisconnectedError(exceptionState); 130 throwPresentationDisconnectedError(exceptionState);
130 return; 131 return;
131 } 132 }
132 133
133 PresentationController* controller = presentationController(); 134 PresentationController* controller = presentationController();
134 if (controller) 135 if (controller)
135 controller->send(m_url, m_id, data, size); 136 controller->send(m_url, m_id, data, size);
136 } 137 }
137 138
139 void PresentationSession::didReceiveTextMessage(const String& message)
140 {
141 dispatchEvent(MessageEvent::create(message));
142 }
143
138 void PresentationSession::close() 144 void PresentationSession::close()
139 { 145 {
140 if (m_state != WebPresentationSessionState::Connected) 146 if (m_state != WebPresentationSessionState::Connected)
141 return; 147 return;
142 PresentationController* controller = presentationController(); 148 PresentationController* controller = presentationController();
143 if (controller) 149 if (controller)
144 controller->closeSession(m_url, m_id); 150 controller->closeSession(m_url, m_id);
145 } 151 }
146 152
147 bool PresentationSession::matches(WebPresentationSessionClient* client) const 153 bool PresentationSession::matches(WebPresentationSessionClient* client) const
(...skipping 11 matching lines...) Expand all
159 } 165 }
160 166
161 PresentationController* PresentationSession::presentationController() 167 PresentationController* PresentationSession::presentationController()
162 { 168 {
163 if (!frame()) 169 if (!frame())
164 return nullptr; 170 return nullptr;
165 return PresentationController::from(*frame()); 171 return PresentationController::from(*frame());
166 } 172 }
167 173
168 } // namespace blink 174 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/presentation/PresentationSession.h ('k') | public/platform/modules/presentation/WebPresentationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698