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

Unified Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 2484273003: [Presentation API] (1-UA) fire PresentationConnection onterminate event if receiver page gets destr… (Closed)
Patch Set: rebase Created 3 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: content/renderer/presentation/presentation_dispatcher.cc
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index 7621c0193218aaaef9a585d0298021a993426978..f3a4f9ec80da77911150969e0362b65ff9a2a6c8 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -282,9 +282,14 @@ void PresentationDispatcher::closeSession(
presentationId.utf8());
}
-void PresentationDispatcher::terminateSession(
+void PresentationDispatcher::terminateConnection(
const blink::WebURL& presentationUrl,
const blink::WebString& presentationId) {
+ if (receiver_) {
+ receiver_->terminateConnection();
+ return;
+ }
+
ConnectToPresentationServiceIfNeeded();
presentation_service_->Terminate(presentationUrl, presentationId.utf8());
}
@@ -403,6 +408,14 @@ void PresentationDispatcher::OnDestruct() {
delete this;
}
+void PresentationDispatcher::WidgetWillClose() {
+ if (!receiver_)
+ return;
+
+ receiver_->didChangeSessionState(
+ blink::WebPresentationConnectionState::Terminated);
+}
+
void PresentationDispatcher::OnScreenAvailabilityUpdated(const GURL& url,
bool available) {
auto* listening_status = GetListeningStatus(url);

Powered by Google App Engine
This is Rietveld 408576698