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..afdea0e3f6aea846999522e60d2ea663ab89f265 100644 |
--- a/content/renderer/presentation/presentation_dispatcher.cc |
+++ b/content/renderer/presentation/presentation_dispatcher.cc |
@@ -67,6 +67,18 @@ void PresentationDispatcher::updateAvailableChangeWatched(bool watched) { |
} |
} |
+void PresentationDispatcher::updateDefaultPresentationStartWatched( |
+ bool watched) { |
+ ConnectToPresentationServiceIfNeeded(); |
+ if (watched) { |
+ presentation_service_->WaitForDefaultPresentation( |
+ base::Bind(&PresentationDispatcher::OnDefaultPresentationStarted, |
+ base::Unretained(this))); |
Peter Beverloo
2015/03/03 21:40:40
nit: indentation
whywhat
2015/03/05 20:26:14
Done.
|
+ } else { |
+ presentation_service_->OnDefaultPresentationListenerRemoved(); |
+ } |
+} |
+ |
void PresentationDispatcher::startSession( |
const blink::WebString& presentationUrl, |
const blink::WebString& presentationId, |
@@ -113,6 +125,23 @@ void PresentationDispatcher::OnScreenAvailabilityChanged(bool available) { |
controller_->didChangeAvailability(available); |
} |
+void PresentationDispatcher::OnDefaultPresentationStarted( |
+ presentation::PresentationSessionInfoPtr session_info) { |
+ if (!controller_) |
+ return; |
+ |
+ // Reset the callback to get the next event. |
+ updateDefaultPresentationStartWatched( |
+ controller_->isDefaultPresentationStartWatched()); |
+ |
+ DCHECK(!session_info.is_null()); |
+ PresentationSessionDispatcher* session_dispatcher = |
+ new PresentationSessionDispatcher(session_info.Pass()); |
+ presentation_session_dispatchers_.push_back(session_dispatcher); |
+ controller_->didStartDefaultPresentation( |
+ new PresentationSessionClient(session_dispatcher)); |
+} |
+ |
void PresentationDispatcher::OnSessionCreated( |
blink::WebPresentationSessionClientCallbacks* callback, |
presentation::PresentationSessionInfoPtr session_info, |