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

Unified Diff: chrome/common/media_router/mojo/media_router_struct_traits.h

Issue 2947403004: [MediaRouter] Replace RouteMessage with PresentationConnectionMessage (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « chrome/common/media_router/mojo/media_router.typemap ('k') | chrome/common/media_router/route_message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/media_router/mojo/media_router_struct_traits.h
diff --git a/chrome/common/media_router/mojo/media_router_struct_traits.h b/chrome/common/media_router/mojo/media_router_struct_traits.h
index 06f0940d3e81a497518100ceb39e4a85d328152f..5ca26ea8b73b8d6f93b8b4a36fce476e833a90b7 100644
--- a/chrome/common/media_router/mojo/media_router_struct_traits.h
+++ b/chrome/common/media_router/mojo/media_router_struct_traits.h
@@ -157,53 +157,43 @@ struct StructTraits<media_router::mojom::CastMediaSinkDataView,
template <>
struct StructTraits<media_router::mojom::RouteMessageDataView,
- media_router::RouteMessage> {
+ content::PresentationConnectionMessage> {
static media_router::mojom::RouteMessage::Type type(
- const media_router::RouteMessage& msg) {
- switch (msg.type) {
- case media_router::RouteMessage::TEXT:
- return media_router::mojom::RouteMessage::Type::TEXT;
- case media_router::RouteMessage::BINARY:
- return media_router::mojom::RouteMessage::Type::BINARY;
- }
+ const content::PresentationConnectionMessage& msg) {
+ if (msg.message)
+ return media_router::mojom::RouteMessage::Type::TEXT;
+ else if (msg.data)
+ return media_router::mojom::RouteMessage::Type::BINARY;
NOTREACHED();
return media_router::mojom::RouteMessage::Type::TEXT;
}
static const base::Optional<std::string>& message(
- const media_router::RouteMessage& msg) {
- return msg.text;
+ const content::PresentationConnectionMessage& msg) {
+ return msg.message;
}
static const base::Optional<std::vector<uint8_t>>& data(
- const media_router::RouteMessage& msg) {
- return msg.binary;
+ const content::PresentationConnectionMessage& msg) {
+ return msg.data;
}
static bool Read(media_router::mojom::RouteMessageDataView data,
- media_router::RouteMessage* out) {
+ content::PresentationConnectionMessage* out) {
media_router::mojom::RouteMessage::Type type;
if (!data.ReadType(&type))
return false;
switch (type) {
case media_router::mojom::RouteMessage::Type::TEXT: {
- out->type = media_router::RouteMessage::TEXT;
- base::Optional<std::string> text;
- if (!data.ReadMessage(&text) || !text)
+ if (!data.ReadMessage(&out->message) || !out->message)
return false;
- out->text = std::move(text);
break;
}
case media_router::mojom::RouteMessage::Type::BINARY: {
- out->type = media_router::RouteMessage::BINARY;
- base::Optional<std::vector<uint8_t>> binary;
- if (!data.ReadData(&binary) || !binary)
+ if (!data.ReadData(&out->data) || !out->data)
return false;
- out->binary = std::move(binary);
break;
}
- default:
- return false;
}
return true;
}
« no previous file with comments | « chrome/common/media_router/mojo/media_router.typemap ('k') | chrome/common/media_router/route_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698