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

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: resolve code review comments from Mark 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 2743b5d563a1033130166ce77a45b00676ff5738..62e1ff4a684c6bd563a5b7b51e57a3bd1a67b62e 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -267,11 +267,19 @@ void PresentationDispatcher::closeSession(
presentationId.utf8());
}
-void PresentationDispatcher::terminateSession(
+void PresentationDispatcher::terminateConnection(
const blink::WebURL& presentationUrl,
const blink::WebString& presentationId) {
- ConnectToPresentationServiceIfNeeded();
- presentation_service_->Terminate(presentationUrl, presentationId.utf8());
+ if (receiver_) {
+ receiver_->terminateConnection();
+ return;
+ }
+
+ if (controller_) {
+ ConnectToPresentationServiceIfNeeded();
+ presentation_service_->Terminate(presentationUrl, presentationId.utf8());
+ return;
+ }
}
void PresentationDispatcher::getAvailability(
@@ -388,6 +396,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