| Index: content/renderer/presentation/presentation_dispatcher.cc
|
| diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
|
| index c074df3d823dc97bfaf68ce6480666de7845e3be..c07f2658e2a5b2bc045bee6a321cf72bc256df5e 100644
|
| --- a/content/renderer/presentation/presentation_dispatcher.cc
|
| +++ b/content/renderer/presentation/presentation_dispatcher.cc
|
| @@ -211,6 +211,28 @@ void PresentationDispatcher::OnSessionStateChange(
|
| GetWebPresentationSessionStateFromMojo(session_state));
|
| }
|
|
|
| +void PresentationDispatcher::OnSessionMessagesReceived(
|
| + mojo::Array<presentation::SessionMessagePtr> messages) {
|
| + if (!controller_)
|
| + return;
|
| +
|
| + for (size_t i = 0; i < messages.size(); ++i) {
|
| + if (messages[i]->type ==
|
| + presentation::PresentationMessageType::PRESENTATION_MESSAGE_TYPE_TEXT) {
|
| + controller_->didReceiveSessionTextMessage(
|
| + new PresentationSessionClient(messages[i]->presentation_url,
|
| + messages[i]->presentation_id),
|
| + blink::WebString::fromUTF8(messages[i]->message));
|
| + } else {
|
| + // TODO(haibinlu): handle binary message
|
| + }
|
| + }
|
| +
|
| + presentation_service_->ListenForSessionMessages(
|
| + base::Bind(&PresentationDispatcher::OnSessionMessagesReceived,
|
| + base::Unretained(this)));
|
| +}
|
| +
|
| void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() {
|
| if (presentation_service_.get())
|
| return;
|
| @@ -226,6 +248,9 @@ void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() {
|
| presentation_service_->ListenForSessionStateChange(base::Bind(
|
| &PresentationDispatcher::OnSessionStateChange,
|
| base::Unretained(this)));
|
| + presentation_service_->ListenForSessionMessages(
|
| + base::Bind(&PresentationDispatcher::OnSessionMessagesReceived,
|
| + base::Unretained(this)));
|
| */
|
| }
|
|
|
|
|