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 5c1e969ee2a202abf3d94b54efc9a56ed1d53a68..be86317dd8b472533c8efbebebca533efe636dbe 100644 |
| --- a/content/renderer/presentation/presentation_dispatcher.cc |
| +++ b/content/renderer/presentation/presentation_dispatcher.cc |
| @@ -383,8 +383,13 @@ void PresentationDispatcher::setDefaultPresentationUrls( |
| void PresentationDispatcher::setReceiver( |
| blink::WebPresentationReceiver* receiver) { |
| - ConnectToPresentationServiceIfNeeded(); |
| receiver_ = receiver; |
| + |
| + // Create receiver PSImpl after loading document. |
| + if (render_frame() && render_frame()->GetWebFrame() && |
| + !render_frame()->GetWebFrame()->isLoading()) { |
| + ConnectToPresentationServiceIfNeeded(); |
| + } |
| } |
| void PresentationDispatcher::DidCommitProvisionalLoad( |
| @@ -400,6 +405,11 @@ void PresentationDispatcher::DidCommitProvisionalLoad( |
| std::swap(message_request_queue_, empty); |
| } |
| +void PresentationDispatcher::DidFinishDocumentLoad() { |
|
mark a. foltz
2017/04/10 21:59:57
I'm assuming that receiver_ is set only for presen
zhaobin
2017/04/11 00:03:08
Yes. receiver_ is only set for receiver documents.
|
| + if (receiver_) |
| + ConnectToPresentationServiceIfNeeded(); |
| +} |
| + |
| void PresentationDispatcher::OnDestruct() { |
| delete this; |
| } |