Chromium Code Reviews| Index: Source/modules/presentation/PresentationSession.cpp |
| diff --git a/Source/modules/presentation/PresentationSession.cpp b/Source/modules/presentation/PresentationSession.cpp |
| index 47ba6253b3d33c471419808f6e6918b48f272bdd..821f1b41b0c0ff326021f18edff0eadcf98b061b 100644 |
| --- a/Source/modules/presentation/PresentationSession.cpp |
| +++ b/Source/modules/presentation/PresentationSession.cpp |
| @@ -5,7 +5,10 @@ |
| #include "config.h" |
| #include "modules/presentation/PresentationSession.h" |
| +#include "core/dom/DOMArrayBuffer.h" |
| +#include "core/dom/DOMArrayBufferView.h" |
| #include "core/dom/Document.h" |
| +#include "core/dom/ExceptionCode.h" |
| #include "core/events/Event.h" |
| #include "core/frame/LocalFrame.h" |
| #include "modules/EventTargetModules.h" |
| @@ -36,6 +39,11 @@ const AtomicString& SessionStateToString(WebPresentationSessionState state) |
| return disconnectedValue; |
| } |
| +void throwInvalidStateError(ExceptionState& exceptionState) |
|
whywhat
2015/03/26 00:14:19
Rename to something reflecting what kind of error
USE s.singapati at gmail.com
2015/03/26 11:57:40
Done.
|
| +{ |
| + exceptionState.throwDOMException(InvalidStateError, "Presentation session is disconnected."); |
| +} |
| + |
| } // namespace |
| PresentationSession::PresentationSession(LocalFrame* frame, const String& id, const String& url) |
| @@ -90,7 +98,26 @@ const AtomicString& PresentationSession::state() const |
| return SessionStateToString(m_state); |
| } |
| -void PresentationSession::postMessage(const String& message) |
| +void PresentationSession::postMessage(const String& message, ExceptionState& exceptionState) |
| +{ |
| + if (m_state != WebPresentationSessionState::Connected) { |
| + throwInvalidStateError(exceptionState); |
| + return; |
| + } |
| + PresentationController* controller = presentationController(); |
| + if (controller) |
| + controller->postMessage(m_url, m_id, message); |
| +} |
| + |
| +void PresentationSession::postMessage(Blob* data, ExceptionState& exceptionState) |
| +{ |
| +} |
| + |
| +void PresentationSession::postMessage(DOMArrayBuffer* data, ExceptionState& exceptionState) |
| +{ |
|
Peter Beverloo
2015/03/25 20:20:29
Why is it OK for these methods to be empty? Can we
USE s.singapati at gmail.com
2015/03/26 11:57:40
Done. Added TODOs for now. I think blink side impl
|
| +} |
| + |
| +void PresentationSession::postMessage(DOMArrayBufferView* data, ExceptionState& exceptionState) |
| { |
| } |