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

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

Issue 1194123003: [PresentationAPI] on-session-message handler for ArrayBuffer and Blob messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/presentation/presentation_dispatcher.cc
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index f2029883f0b60fe6837857a73016d36a36decb50..6b2c08e67c03522c748661a7dcc237f0b0967928 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -375,14 +375,32 @@ void PresentationDispatcher::OnSessionMessagesReceived(
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
+ // Note: Passing batches of messages to the Blink layer would be more
+ // efficient.
+ scoped_ptr<PresentationSessionClient> session_client(
+ new PresentationSessionClient(messages[i]->presentation_url,
+ messages[i]->presentation_id));
+ switch (messages[i]->type) {
+ case presentation::PresentationMessageType::
+ PRESENTATION_MESSAGE_TYPE_TEXT: {
+ controller_->didReceiveSessionTextMessage(
+ session_client.release(),
+ blink::WebString::fromUTF8(messages[i]->message));
+ break;
+ }
+ case presentation::PresentationMessageType::
+ PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER:
+ case presentation::PresentationMessageType::
+ PRESENTATION_MESSAGE_TYPE_BLOB: {
+ controller_->didReceiveSessionBinaryMessage(
+ session_client.release(), &(messages[i]->data.front()),
+ messages[i]->data.size());
+ break;
+ }
+ default: {
+ NOTREACHED();
+ break;
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698