Index: content/renderer/presentation/presentation_dispatcher.cc |
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc |
index e52f9c93329793135dd02f9c1e8425e7082b18c9..4e6a3c7281915178832a93451171719b7b46ed64 100644 |
--- a/content/renderer/presentation/presentation_dispatcher.cc |
+++ b/content/renderer/presentation/presentation_dispatcher.cc |
@@ -348,6 +348,9 @@ void PresentationDispatcher::OnScreenAvailabilityUpdated(bool available) { |
for (auto observer : availability_observers_) |
observer->availabilityChanged(available); |
+ for (auto observer : availability_observers_) |
+ observer->availabilityChanged(available); |
+ |
for (AvailabilityCallbacksMap::iterator iter(&availability_callbacks_); |
!iter.IsAtEnd(); iter.Advance()) { |
iter.GetCurrentValue()->onSuccess(new bool(available)); |
@@ -357,6 +360,23 @@ void PresentationDispatcher::OnScreenAvailabilityUpdated(bool available) { |
UpdateListeningState(); |
} |
+void PresentationDispatcher::OnScreenAvailabilityNotSupported() { |
+ DCHECK(listening_state_ == ListeningState::Waiting); |
+ |
+ for (AvailabilityCallbacksMap::iterator iter(&availability_callbacks_); |
+ !iter.IsAtEnd(); iter.Advance()) { |
+ iter.GetCurrentValue()->onError(new blink::WebPresentationError( |
+ blink::WebPresentationError::ErrorTypeAvailabilityNotSupported, |
+ blink::WebString::fromUTF8( |
+ "getAvailability() isn't supported at the moment. It can be due to" |
+ "a permanent or temporary system limitation. It is recommended to" |
+ "try to blindly start a session in that case."))); |
+ } |
+ availability_callbacks_.Clear(); |
+ |
+ UpdateListeningState(); |
+} |
+ |
void PresentationDispatcher::OnDefaultSessionStarted( |
presentation::PresentationSessionInfoPtr session_info) { |
if (!controller_) |