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

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

Issue 1015903002: [Presentation API] Adds close method to Presentation session. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addresses whywhat's comments Created 5 years, 9 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 03ac8d4cb0c029fe14854bc4e4bdaa7b1d9f7dd3..4727bebdb9c0397281ff4af261da66203d9597eb 100644
--- a/Source/modules/presentation/PresentationSession.cpp
+++ b/Source/modules/presentation/PresentationSession.cpp
@@ -9,15 +9,17 @@
#include "core/frame/LocalFrame.h"
#include "modules/EventTargetModules.h"
#include "modules/presentation/Presentation.h"
+#include "modules/presentation/PresentationController.h"
#include "public/platform/WebString.h"
#include "public/platform/modules/presentation/WebPresentationSessionClient.h"
#include "wtf/OwnPtr.h"
namespace blink {
-PresentationSession::PresentationSession(LocalFrame* frame, const WebString& id)
+PresentationSession::PresentationSession(LocalFrame* frame, const WebString& id, const WebString& url)
: DOMWindowProperty(frame)
, m_id(id)
+ , m_url(url)
, m_state("disconnected")
{
}
@@ -33,7 +35,7 @@ PresentationSession* PresentationSession::take(WebPresentationSessionClient* cli
ASSERT(presentation);
OwnPtr<WebPresentationSessionClient> client = adoptPtr(clientRaw);
- PresentationSession* session = new PresentationSession(presentation->frame(), client->getId());
+ PresentationSession* session = new PresentationSession(presentation->frame(), client->getId(), client->getUrl());
presentation->registerSession(session);
return session;
}
@@ -67,6 +69,18 @@ void PresentationSession::postMessage(const String& message)
void PresentationSession::close()
{
+ if (m_state != "connected")
+ return;
+ PresentationController* controller = presentationController();
+ if (controller)
+ controller->closeSession(m_url, m_id);
+}
+
+PresentationController* PresentationSession::presentationController()
+{
+ if (!frame())
+ return nullptr;
+ return PresentationController::from(*frame());
}
} // namespace blink
« no previous file with comments | « Source/modules/presentation/PresentationSession.h ('k') | public/platform/modules/presentation/WebPresentationClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698