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

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

Issue 978543002: [Presentation API] Plumbing the |defaultpresentationstart| event from Blink to browser/Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed DefaultPresentation to DefaultSession in line with the Blink CL Created 5 years, 9 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
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/presentation/presentation_dispatcher.cc
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index 88236345a26ab374f4a9fdc7ca6ee917ba8fb7b5..b4b952c518a542a263f218b8b9f718635cb123b4 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -113,6 +113,24 @@ void PresentationDispatcher::OnScreenAvailabilityChanged(bool available) {
controller_->didChangeAvailability(available);
}
+void PresentationDispatcher::OnDefaultSessionStarted(
+ presentation::PresentationSessionInfoPtr session_info) {
+ if (!controller_)
+ return;
+
+ // Reset the callback to get the next event.
+ presentation_service_->ListenForDefaultSessionStart(base::Bind(
+ &PresentationDispatcher::OnDefaultSessionStarted,
+ base::Unretained(this)));
+
+ DCHECK(!session_info.is_null());
+ PresentationSessionDispatcher* session_dispatcher =
+ new PresentationSessionDispatcher(session_info.Pass());
+ presentation_session_dispatchers_.push_back(session_dispatcher);
+ controller_->didStartDefaultSession(
+ new PresentationSessionClient(session_dispatcher));
+}
+
void PresentationDispatcher::OnSessionCreated(
blink::WebPresentationSessionClientCallbacks* callback,
presentation::PresentationSessionInfoPtr session_info,
@@ -139,6 +157,9 @@ void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() {
render_frame()->GetServiceRegistry()->ConnectToRemoteService(
&presentation_service_);
+ presentation_service_->ListenForDefaultSessionStart(base::Bind(
+ &PresentationDispatcher::OnDefaultSessionStarted,
+ base::Unretained(this)));
}
} // namespace content
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698