Chromium Code Reviews| Index: content/renderer/presentation/presentation_dispatcher.h |
| diff --git a/content/renderer/presentation/presentation_dispatcher.h b/content/renderer/presentation/presentation_dispatcher.h |
| index 4642a644ba19899a626ce3a0db05f8e070d277cf..ca5ce6ddb97d2eb99113f8be2d9bf5189169c545 100644 |
| --- a/content/renderer/presentation/presentation_dispatcher.h |
| +++ b/content/renderer/presentation/presentation_dispatcher.h |
| @@ -6,6 +6,7 @@ |
| #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| #include "base/compiler_specific.h" |
| +#include "base/id_map.h" |
| #include "base/memory/linked_ptr.h" |
| #include "content/common/content_export.h" |
| #include "content/common/presentation/presentation_service.mojom.h" |
| @@ -13,6 +14,7 @@ |
| #include "third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h" |
| namespace blink { |
| +class WebPresentationAvailabilityObserver; |
| class WebString; |
| } // namespace blink |
| @@ -58,6 +60,11 @@ class CONTENT_EXPORT PresentationDispatcher |
| virtual void closeSession( |
| const blink::WebString& presentationUrl, |
| const blink::WebString& presentationId); |
| + virtual void getAvailability( |
| + const blink::WebString& presentationUrl, |
| + blink::WebPresentationAvailabilityCallbacks* callbacks); |
| + virtual void startListening(blink::WebPresentationAvailabilityObserver*); |
| + virtual void stopListening(blink::WebPresentationAvailabilityObserver*); |
| // RenderFrameObserver implementation. |
| void DidChangeDefaultPresentation() override; |
| @@ -84,6 +91,8 @@ class CONTENT_EXPORT PresentationDispatcher |
| void ConnectToPresentationServiceIfNeeded(); |
| + void UpdateListeningState(); |
| + |
| // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| blink::WebPresentationController* controller_; |
| presentation::PresentationServicePtr presentation_service_; |
| @@ -95,6 +104,23 @@ class CONTENT_EXPORT PresentationDispatcher |
| std::queue<linked_ptr<presentation::SessionMessage>>; |
| MessageRequestQueue message_request_queue_; |
| + enum class ListeningState { |
| + Inactive, |
| + Waiting, |
|
whywhat
2015/07/02 22:42:48
This state is not used, only to assign it to the l
mlamouri (slow - plz ping)
2015/07/03 13:35:46
It is not directly used but indirectly. When getAv
|
| + Active, |
| + }; |
| + |
| + ListeningState listening_; |
|
whywhat
2015/07/02 22:42:48
s/listening_/listening_state_
mlamouri (slow - plz ping)
2015/07/03 13:35:46
Done.
|
| + bool previous_availability_; |
|
whywhat
2015/07/02 22:42:48
nit: previous to what? last_known_availability_ ma
mlamouri (slow - plz ping)
2015/07/03 13:35:46
Done.
|
| + |
| + using AvailabilityCallbacksMap = |
| + IDMap<blink::WebPresentationAvailabilityCallbacks, IDMapOwnPointer>; |
| + AvailabilityCallbacksMap availability_callbacks_; |
| + |
| + using AvailabilityObserversSet = |
| + std::set<blink::WebPresentationAvailabilityObserver*>; |
| + AvailabilityObserversSet availability_observers_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
| }; |