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

Unified Diff: content/browser/presentation/presentation_service_impl.cc

Issue 1140713005: [PresentationAPI] Implements send API for Blob data from WebPresentationClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated unit tests Created 5 years, 7 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/browser/presentation/presentation_service_impl.cc
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc
index 916ddedd356548c9607c8a1ca4b26fba513c95ed..b1ecd6a57c7d011724e8505c9f598417dee175be 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -49,6 +49,20 @@ presentation::SessionMessagePtr ToMojoSessionMessage(
return output.Pass();
}
+content::PresentationMessageType GetMessageTypeFromMojo(
+ presentation::PresentationMessageType mojoPresentationMessageType) {
+ switch (mojoPresentationMessageType) {
+ case presentation::PRESENTATION_MESSAGE_TYPE_TEXT:
+ return content::PresentationMessageType::TEXT;
+ case presentation::PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER:
+ return content::PresentationMessageType::ARRAY_BUFFER;
+ case presentation::PRESENTATION_MESSAGE_TYPE_BLOB:
+ return content::PresentationMessageType::BLOB;
+ }
+ NOTREACHED();
+ return content::PresentationMessageType::ARRAY_BUFFER;
+}
+
scoped_ptr<content::PresentationSessionMessage> GetPresentationSessionMessage(
presentation::SessionMessagePtr input) {
DCHECK(!input.is_null());
@@ -67,8 +81,8 @@ scoped_ptr<content::PresentationSessionMessage> GetPresentationSessionMessage(
make_scoped_ptr(new std::string));
input->message.Swap(output->message.get());
- } else if (input->type == presentation::PresentationMessageType::
- PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER) {
+ } else {
+ // ArrayBuffer or Blob data.
mark a. foltz 2015/06/02 23:51:02 Prefer using switch() statement with NOTREACHED so
USE s.singapati at gmail.com 2015/06/03 15:03:50 Done.
DCHECK(!input->data.is_null());
DCHECK(input->message.is_null());
// Return null PresentationSessionMessage if size exceeds.
@@ -78,7 +92,8 @@ scoped_ptr<content::PresentationSessionMessage> GetPresentationSessionMessage(
output = content::PresentationSessionMessage::CreateBinaryMessage(
input->presentation_url,
input->presentation_id,
- make_scoped_ptr(new std::vector<uint8_t>));
+ make_scoped_ptr(new std::vector<uint8_t>),
+ GetMessageTypeFromMojo(input->type));
input->data.Swap(output->data.get());
}

Powered by Google App Engine
This is Rietveld 408576698