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

Unified Diff: third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp

Issue 2484273003: [Presentation API] (1-UA) fire PresentationConnection onterminate event if receiver page gets destr… (Closed)
Patch Set: Created 4 years, 1 month 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: third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp b/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
index d7b86b576b1fde3121a28145f635e76542ed0e9a..226b43a5cae741b6f8358d3977476a8bfca60d22 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
@@ -9,6 +9,7 @@
#include "core/dom/DOMException.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
+#include "core/frame/DOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "modules/presentation/PresentationConnection.h"
#include "modules/presentation/PresentationConnectionList.h"
@@ -59,6 +60,20 @@ void PresentationReceiver::onReceiverConnectionAvailable(
m_connectionList->dispatchConnectionAvailableEvent(connection);
}
+void PresentationReceiver::didChangeSessionState(
+ WebPresentationConnectionState state) {
+ DCHECK(state == WebPresentationConnectionState::Terminated);
+
+ for (auto connection : m_connectionList->connections())
+ connection->didChangeState(state);
+}
+
+void PresentationReceiver::closeWindow() {
+ DOMWindow* window = frame()->domWindow();
+ if (!window->closed())
haraken 2016/11/08 23:44:50 You need to check if frame(), frame()->domWindow()
zhaobin 2016/11/09 03:40:12 Done.
+ window->close(frame()->document());
+}
+
void PresentationReceiver::registerConnection(
PresentationConnection* connection) {
DCHECK(m_connectionList);

Powered by Google App Engine
This is Rietveld 408576698