Chromium Code Reviews| 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( |