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

Side by Side Diff: chrome/browser/media/router/route_message.cc

Issue 2138013003: media::mojom::Remoter and CastRemotingConnector/Sender (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CastRemotingConnector unit tests, and misc. Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/media/router/route_message.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/media/router/route_message.h" 5 #include "chrome/browser/media/router/route_message.h"
6 6
7 #include "base/json/string_escape.h"
8
7 namespace media_router { 9 namespace media_router {
8 10
9 RouteMessage::RouteMessage() = default; 11 RouteMessage::RouteMessage() = default;
10 RouteMessage::RouteMessage(const RouteMessage& other) = default; 12 RouteMessage::RouteMessage(const RouteMessage& other) = default;
11 RouteMessage::~RouteMessage() = default; 13 RouteMessage::~RouteMessage() = default;
12 14
15 std::string RouteMessage::ToHumanReadableString() const {
16 if (!text && !binary)
17 return "null";
18 if ((type == TEXT && !text) || (type == BINARY && !binary))
19 return "illegal value";
20 std::string result;
21 if (text) {
22 result = "text=";
23 base::EscapeJSONString(*text, true, &result);
24 } else {
25 result = "binary=";
26 const base::StringPiece src(reinterpret_cast<const char*>(binary->data()),
27 binary->size());
28 base::EscapeJSONString(src, true, &result);
29 }
30 return result;
31 }
32
13 } // namespace media_router 33 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/browser/media/router/route_message.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698