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

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: merge with master 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..5e6114215f36d53918022c782d57d5e3ecfb2db8 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -270,8 +270,16 @@ void PresentationDispatcher::closeSession(
void PresentationDispatcher::terminateSession(
const blink::WebURL& presentationUrl,
const blink::WebString& presentationId) {
- ConnectToPresentationServiceIfNeeded();
- presentation_service_->Terminate(presentationUrl, presentationId.utf8());
+ if (receiver_) {
+ receiver_->closeWindow();
+ return;
+ }
+
+ if (controller_) {
+ ConnectToPresentationServiceIfNeeded();
+ presentation_service_->Terminate(presentationUrl, presentationId.utf8());
+ return;
+ }
}
void PresentationDispatcher::getAvailability(
@@ -556,11 +564,18 @@ void PresentationDispatcher::OnConnectionStateChanged(
if (!controller_)
imcheng 2017/02/24 19:20:33 this check no longer needed?
zhaobin 2017/02/25 01:31:03 Done.
return;
- controller_->didChangeSessionState(
- blink::WebPresentationSessionInfo(
- session_info.presentation_url,
- blink::WebString::fromUTF8(session_info.presentation_id)),
- GetWebPresentationConnectionState(state));
+ if (receiver_) {
+ receiver_->didChangeSessionState(GetWebPresentationConnectionState(state));
+ return;
+ }
+
+ if (controller_) {
+ controller_->didChangeSessionState(
+ blink::WebPresentationSessionInfo(
+ session_info.presentation_url,
+ blink::WebString::fromUTF8(session_info.presentation_id)),
+ GetWebPresentationConnectionState(state));
+ }
}
void PresentationDispatcher::OnConnectionClosed(

Powered by Google App Engine
This is Rietveld 408576698