| Index: Source/modules/presentation/PresentationSession.cpp
|
| diff --git a/Source/modules/presentation/PresentationSession.cpp b/Source/modules/presentation/PresentationSession.cpp
|
| index a7920a0747f08f762c06e42e10cc656b282f16e3..03ac8d4cb0c029fe14854bc4e4bdaa7b1d9f7dd3 100644
|
| --- a/Source/modules/presentation/PresentationSession.cpp
|
| +++ b/Source/modules/presentation/PresentationSession.cpp
|
| @@ -5,12 +5,20 @@
|
| #include "config.h"
|
| #include "modules/presentation/PresentationSession.h"
|
|
|
| +#include "core/dom/Document.h"
|
| +#include "core/frame/LocalFrame.h"
|
| #include "modules/EventTargetModules.h"
|
| +#include "modules/presentation/Presentation.h"
|
| +#include "public/platform/WebString.h"
|
| +#include "public/platform/modules/presentation/WebPresentationSessionClient.h"
|
| +#include "wtf/OwnPtr.h"
|
|
|
| namespace blink {
|
|
|
| -PresentationSession::PresentationSession(ExecutionContext* executionContext)
|
| - : ContextLifecycleObserver(executionContext)
|
| +PresentationSession::PresentationSession(LocalFrame* frame, const WebString& id)
|
| + : DOMWindowProperty(frame)
|
| + , m_id(id)
|
| + , m_state("disconnected")
|
| {
|
| }
|
|
|
| @@ -19,9 +27,21 @@ PresentationSession::~PresentationSession()
|
| }
|
|
|
| // static
|
| -PresentationSession* PresentationSession::create(ExecutionContext* executionContext)
|
| +PresentationSession* PresentationSession::take(WebPresentationSessionClient* clientRaw, Presentation* presentation)
|
| {
|
| - return new PresentationSession(executionContext);
|
| + ASSERT(clientRaw);
|
| + ASSERT(presentation);
|
| + OwnPtr<WebPresentationSessionClient> client = adoptPtr(clientRaw);
|
| +
|
| + PresentationSession* session = new PresentationSession(presentation->frame(), client->getId());
|
| + presentation->registerSession(session);
|
| + return session;
|
| +}
|
| +
|
| +// static
|
| +void PresentationSession::dispose(WebPresentationSessionClient* client)
|
| +{
|
| + delete client;
|
| }
|
|
|
| const AtomicString& PresentationSession::interfaceName() const
|
| @@ -31,13 +51,14 @@ const AtomicString& PresentationSession::interfaceName() const
|
|
|
| ExecutionContext* PresentationSession::executionContext() const
|
| {
|
| - return ContextLifecycleObserver::executionContext();
|
| -}
|
| + if (!frame())
|
| + return nullptr;
|
| + return frame()->document();}
|
|
|
| DEFINE_TRACE(PresentationSession)
|
| {
|
| RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::trace(visitor);
|
| - ContextLifecycleObserver::trace(visitor);
|
| + DOMWindowProperty::trace(visitor);
|
| }
|
|
|
| void PresentationSession::postMessage(const String& message)
|
|
|