| 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);
|
|
|