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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |