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

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

Issue 2706463002: [Presentation API] Mojo typemap for content::PresentationConnectionMessage (Closed)
Patch Set: Fix compile error after rebase Created 3 years, 10 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_connection_proxy.cc
diff --git a/content/renderer/presentation/presentation_connection_proxy.cc b/content/renderer/presentation/presentation_connection_proxy.cc
index aebff14183ac5a7de998df1213d7c7f8da41c179..8e1a01d482100459c6b1784d07aca77bfb48237d 100644
--- a/content/renderer/presentation/presentation_connection_proxy.cc
+++ b/content/renderer/presentation/presentation_connection_proxy.cc
@@ -25,35 +25,23 @@ PresentationConnectionProxy::PresentationConnectionProxy(
PresentationConnectionProxy::~PresentationConnectionProxy() = default;
void PresentationConnectionProxy::SendConnectionMessage(
- blink::mojom::ConnectionMessagePtr connection_message,
+ PresentationConnectionMessage message,
const OnMessageCallback& callback) const {
DCHECK(target_connection_ptr_);
- target_connection_ptr_->OnMessage(std::move(connection_message), callback);
+ target_connection_ptr_->OnMessage(std::move(message), callback);
}
void PresentationConnectionProxy::OnMessage(
- blink::mojom::ConnectionMessagePtr message,
+ PresentationConnectionMessage message,
const OnMessageCallback& callback) {
DCHECK(!callback.is_null());
- switch (message->type) {
- case blink::mojom::PresentationMessageType::TEXT: {
- DCHECK(message->message);
- source_connection_->didReceiveTextMessage(
- blink::WebString::fromUTF8(message->message.value()));
- break;
- }
- case blink::mojom::PresentationMessageType::BINARY: {
- DCHECK(message->data);
- source_connection_->didReceiveBinaryMessage(&(message->data->front()),
- message->data->size());
- break;
- }
- default: {
- callback.Run(false);
- NOTREACHED();
- return;
- }
+ if (message.is_binary()) {
+ source_connection_->didReceiveBinaryMessage(&(message.data->front()),
+ message.data->size());
+ } else {
+ source_connection_->didReceiveTextMessage(
+ blink::WebString::fromUTF8(*(message.message)));
}
callback.Run(true);

Powered by Google App Engine
This is Rietveld 408576698