Index: content/browser/presentation/presentation_service_impl.cc |
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc |
index 539097ca10385e045a5fa04deaeb296bcddd4f07..4cda1095601b245ed7094a996109bc2454c3c5e8 100644 |
--- a/content/browser/presentation/presentation_service_impl.cc |
+++ b/content/browser/presentation/presentation_service_impl.cc |
@@ -202,7 +202,8 @@ void PresentationServiceImpl::ListenForScreenAvailability( |
listener.get())) { |
screen_availability_listeners_.set(availability_url, listener.Pass()); |
} else { |
- DVLOG(1) << "AddScreenAvailabilityListener failed. Ignoring request."; |
+ DVLOG(1) << "AddScreenAvailabilityListener failed. Returning false."; |
+ client_->OnScreenAvailabilityUpdated(url, false); |
} |
} |
@@ -457,6 +458,33 @@ void PresentationServiceImpl::ListenForSessionMessages( |
weak_factory_.GetWeakPtr(), session_info)); |
} |
+void PresentationServiceImpl::GetPresentationReceiverSession( |
+ const GetPresentationReceiverSessionMojoCallback& callback) { |
+ DVLOG(2) << "GetPresentationReceiverSession"; |
+ if (!delegate_) { |
+ callback.Run(presentation::PresentationSessionInfoPtr()); |
+ return; |
+ } |
+ |
+ receiver_session_callback_.reset( |
+ new GetPresentationReceiverSessionMojoCallback(callback)); |
mark a. foltz
2015/10/01 06:25:28
Do we need to wrap the passed-in callback in anoth
imcheng
2015/10/06 00:59:15
1) It used to be that we can't store mojo callback
|
+ delegate_->GetPresentationReceiverSession( |
+ render_process_id_, render_frame_id_, |
+ base::Bind(&PresentationServiceImpl::OnGetPresentationReceiverSession, |
+ weak_factory_.GetWeakPtr())); |
+} |
+ |
+void PresentationServiceImpl::OnGetPresentationReceiverSession( |
+ const content::PresentationSessionInfo* session_info) { |
+ if (receiver_session_callback_) { |
+ receiver_session_callback_->Run( |
+ session_info |
+ ? presentation::PresentationSessionInfo::From(*session_info) |
+ : presentation::PresentationSessionInfoPtr()); |
+ receiver_session_callback_.reset(); |
+ } |
+} |
+ |
void PresentationServiceImpl::OnSessionMessages( |
const PresentationSessionInfo& session, |
const ScopedVector<PresentationSessionMessage>& messages, |
@@ -525,7 +553,7 @@ void PresentationServiceImpl::Reset() { |
default_session_start_context_.reset(); |
- if (on_session_messages_callback_.get()) { |
+ if (on_session_messages_callback_) { |
on_session_messages_callback_->Run( |
mojo::Array<presentation::SessionMessagePtr>()); |
on_session_messages_callback_.reset(); |
@@ -537,6 +565,11 @@ void PresentationServiceImpl::Reset() { |
send_message_callback_->Run(false); |
send_message_callback_.reset(); |
} |
+ |
+ if (receiver_session_callback_) { |
+ receiver_session_callback_->Run(presentation::PresentationSessionInfoPtr()); |
+ receiver_session_callback_.reset(); |
+ } |
} |
void PresentationServiceImpl::OnDelegateDestroyed() { |