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 fb6b4d9a83b02147194dd362b33dc6e1ef65fec0..4e6c51b6844230a3cdaa1c1069f16d99b2e8f956 100644 |
| --- a/content/renderer/presentation/presentation_dispatcher.h |
| +++ b/content/renderer/presentation/presentation_dispatcher.h |
| @@ -6,6 +6,8 @@ |
| #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| #include "base/compiler_specific.h" |
| +#include "base/containers/hash_tables.h" |
|
mark a. foltz
2015/04/10 19:03:18
This #include doesn't seem necessary.
USE s.singapati at gmail.com
2015/04/14 17:51:51
Done.
|
| +#include "base/memory/linked_ptr.h" |
| #include "content/common/content_export.h" |
| #include "content/common/presentation/presentation_service.mojom.h" |
| #include "content/public/renderer/render_frame_observer.h" |
| @@ -27,6 +29,20 @@ class CONTENT_EXPORT PresentationDispatcher |
| ~PresentationDispatcher() override; |
| private: |
| + |
| + // send request from a presentation session. |
| + struct CONTENT_EXPORT MessageRequest { |
| + MessageRequest(const std::string& presentation_url, |
| + const std::string& presentation_id, |
| + const std::string& message); |
| + ~MessageRequest(); |
| + |
| + const std::string presentation_url; |
| + const std::string presentation_id; |
| + const std::string message; |
| + // TODO(s.singapati): Handle ArrayBuffer/View and Blob data. |
| + }; |
| + |
| // WebPresentationClient implementation. |
| virtual void setController( |
| blink::WebPresentationController* controller); |
| @@ -39,12 +55,22 @@ class CONTENT_EXPORT PresentationDispatcher |
| const blink::WebString& presentationUrl, |
| const blink::WebString& presentationId, |
| blink::WebPresentationSessionClientCallbacks* callback); |
| + virtual void send( |
| + const blink::WebString& presentationUrl, |
| + const blink::WebString& presentationId, |
| + const blink::WebString& message); |
| + virtual void send( |
| + const blink::WebString& presentationUrl, |
| + const blink::WebString& presentationId, |
| + const char* data, |
| + size_t length); |
| virtual void closeSession( |
| const blink::WebString& presentationUrl, |
| const blink::WebString& presentationId); |
| // RenderFrameObserver |
| void DidChangeDefaultPresentation() override; |
| + void FrameWillClose() override; |
| void OnScreenAvailabilityChanged( |
| const std::string& presentation_url, |
| @@ -65,9 +91,21 @@ class CONTENT_EXPORT PresentationDispatcher |
| const std::string& presentation_url, |
| bool watched); |
| + void DoSendStringMessage( |
| + const std::string& presentation_url, |
| + const std::string& presentation_id, |
| + const std::string& message); |
| + void HandleSendMessageRequests(); |
| + void RemoveAllMessageRequests(); |
| + |
| // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| blink::WebPresentationController* controller_; |
| presentation::PresentationServicePtr presentation_service_; |
| + |
| + // Message requests are queued here and only one message is sent |
| + // at a time over mojo channel. |
| + using MessageRequestQueue = std::queue<linked_ptr<MessageRequest>>; |
| + MessageRequestQueue message_request_queue_; |
| }; |
| } // namespace content |