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

Unified Diff: Source/modules/presentation/PresentationSession.cpp

Issue 940503002: [PresentationAPI] Added plumbing for start/joinSession from JS to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Full change Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « Source/modules/presentation/PresentationSession.h ('k') | Source/modules/presentation/PresentationSessionClientCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698