Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: content/renderer/presentation/presentation_dispatcher.h

Issue 1259073004: [Presentation API] Change ListenForSessionMessages API to client-style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/presentation/presentation_dispatcher.h
diff --git a/content/renderer/presentation/presentation_dispatcher.h b/content/renderer/presentation/presentation_dispatcher.h
index 1f8887a54c6fdd73c504a356a8fcadb88d26084a..2746c18ad3acd80c53cc2d7fb756c4bf4f76601f 100644
--- a/content/renderer/presentation/presentation_dispatcher.h
+++ b/content/renderer/presentation/presentation_dispatcher.h
@@ -31,6 +31,26 @@ class CONTENT_EXPORT PresentationDispatcher
~PresentationDispatcher() override;
private:
+ struct SendMessageRequest {
+ SendMessageRequest(presentation::PresentationSessionInfoPtr session_info,
+ presentation::SessionMessagePtr message);
+ ~SendMessageRequest();
+
+ presentation::PresentationSessionInfoPtr session_info;
+ presentation::SessionMessagePtr message;
+ };
+
+ static SendMessageRequest* GetSendStringMessageRequest(
haibinlu 2015/07/30 23:16:30 TextMessage?
imcheng 2015/08/03 18:56:33 Done.
+ const blink::WebString& presentationUrl,
+ const blink::WebString& presentationId,
+ const blink::WebString& message);
+ static SendMessageRequest* GetSendDataMessageRequest(
haibinlu 2015/07/30 23:16:30 BinaryMessage
imcheng 2015/08/03 18:56:33 Done.
+ const blink::WebString& presentationUrl,
+ const blink::WebString& presentationId,
+ presentation::PresentationMessageType type,
+ const uint8* data,
+ size_t length);
+
// WebPresentationClient implementation.
virtual void setController(
blink::WebPresentationController* controller);
@@ -77,6 +97,9 @@ class CONTENT_EXPORT PresentationDispatcher
presentation::PresentationSessionInfoPtr session_info,
presentation::PresentationSessionState new_state) override;
void OnScreenAvailabilityNotSupported() override;
+ void OnSessionMessagesReceived(
+ presentation::PresentationSessionInfoPtr session_info,
+ mojo::Array<presentation::SessionMessagePtr> messages) override;
void OnSessionCreated(
blink::WebPresentationSessionClientCallbacks* callback,
@@ -84,17 +107,13 @@ class CONTENT_EXPORT PresentationDispatcher
presentation::PresentationErrorPtr error);
void OnDefaultSessionStarted(
presentation::PresentationSessionInfoPtr session_info);
- void OnSessionMessagesReceived(
- mojo::Array<presentation::SessionMessagePtr> messages);
- void DoSendMessage(const presentation::SessionMessage& session_message);
+ void DoSendMessage(const SendMessageRequest& request);
void HandleSendMessageRequests(bool success);
void ConnectToPresentationServiceIfNeeded();
void UpdateListeningState();
- void StartListenForMessages();
-
// Used as a weak reference. Can be null since lifetime is bound to the frame.
blink::WebPresentationController* controller_;
presentation::PresentationServicePtr presentation_service_;
@@ -102,8 +121,7 @@ class CONTENT_EXPORT PresentationDispatcher
// Message requests are queued here and only one message at a time is sent
// over mojo channel.
- using MessageRequestQueue =
- std::queue<linked_ptr<presentation::SessionMessage>>;
+ using MessageRequestQueue = std::queue<linked_ptr<SendMessageRequest>>;
MessageRequestQueue message_request_queue_;
enum class ListeningState {
@@ -123,8 +141,6 @@ class CONTENT_EXPORT PresentationDispatcher
std::set<blink::WebPresentationAvailabilityObserver*>;
AvailabilityObserversSet availability_observers_;
- bool listening_for_messages_;
-
DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher);
};

Powered by Google App Engine
This is Rietveld 408576698