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

Unified Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 2801823003: [Presentation API] Change connection to 'connected' if start a presentation with "https://www.googl… (Closed)
Patch Set: fix content_unittest and layout test failures Created 3 years, 8 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 5c1e969ee2a202abf3d94b54efc9a56ed1d53a68..2f2e7bfba7ea920f8eef1079efc6572a7528b3da 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -383,8 +383,14 @@ void PresentationDispatcher::setDefaultPresentationUrls(
void PresentationDispatcher::setReceiver(
blink::WebPresentationReceiver* receiver) {
- ConnectToPresentationServiceIfNeeded();
receiver_ = receiver;
+
+ if (!render_frame() || !render_frame()->GetWebFrame())
imcheng 2017/04/08 00:05:59 This seems a bit easier to understand if you flipp
zhaobin 2017/04/08 01:36:01 Done.
+ return;
+
+ // Create receiver PSImpl after loading document.
+ if (!render_frame()->GetWebFrame()->isLoading())
+ ConnectToPresentationServiceIfNeeded();
}
void PresentationDispatcher::DidCommitProvisionalLoad(
@@ -400,6 +406,11 @@ void PresentationDispatcher::DidCommitProvisionalLoad(
std::swap(message_request_queue_, empty);
}
+void PresentationDispatcher::DidFinishDocumentLoad() {
+ if (receiver_)
+ ConnectToPresentationServiceIfNeeded();
+}
+
void PresentationDispatcher::OnDestruct() {
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698