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

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

Issue 1020303004: [PresentationAPI] Plumbing |onstatechange| event for the PresentationSession from Blink to platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added a return statement for the conversion function 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
« no previous file with comments | « Source/modules/presentation/Presentation.h ('k') | Source/modules/presentation/PresentationController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/presentation/Presentation.cpp
diff --git a/Source/modules/presentation/Presentation.cpp b/Source/modules/presentation/Presentation.cpp
index 0e470d6bc75f570accdb7035c48c0620ce362e4e..4c6ddaebe1a6e9815b73600a290024e1a6cec557 100644
--- a/Source/modules/presentation/Presentation.cpp
+++ b/Source/modules/presentation/Presentation.cpp
@@ -17,6 +17,7 @@
#include "modules/presentation/DefaultSessionStartEvent.h"
#include "modules/presentation/PresentationController.h"
#include "modules/presentation/PresentationSessionClientCallbacks.h"
+#include "public/platform/modules/presentation/WebPresentationSessionClient.h"
namespace blink {
@@ -151,6 +152,15 @@ void Presentation::didStartDefaultSession(PresentationSession* session)
dispatchEvent(DefaultSessionStartEvent::create(EventTypeNames::defaultsessionstart, session));
}
+void Presentation::didChangeSessionState(WebPresentationSessionClient* sessionClient, WebPresentationSessionState sessionState)
+{
+ PresentationSession* session = findSession(sessionClient);
+ if (session)
+ session->didChangeState(sessionState);
+
+ PresentationSession::dispose(sessionClient);
+}
+
void Presentation::registerSession(PresentationSession* session)
{
m_openSessions.add(session);
@@ -163,4 +173,13 @@ PresentationController* Presentation::presentationController()
return PresentationController::from(*frame());
}
+PresentationSession* Presentation::findSession(WebPresentationSessionClient* sessionClient)
+{
+ for (const auto& session : m_openSessions) {
+ if (session->matches(sessionClient))
+ return session.get();
+ }
+ return nullptr;
+}
+
} // namespace blink
« no previous file with comments | « Source/modules/presentation/Presentation.h ('k') | Source/modules/presentation/PresentationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698