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

Side by Side Diff: chrome/common/media_router/route_message.cc

Issue 2771413003: Move c/b/media/router/mojo/*.mojom to chrome/common/media_router/mojo/*.mojom (Closed)
Patch Set: Rebase Created 3 years, 8 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
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/common/media_router/route_message.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/string_escape.h" 8 #include "base/json/string_escape.h"
9 9
10 namespace media_router { 10 namespace media_router {
11 11
12 RouteMessage::RouteMessage() = default; 12 RouteMessage::RouteMessage() = default;
13 RouteMessage::RouteMessage(const RouteMessage& other) = default; 13 RouteMessage::RouteMessage(const RouteMessage& other) = default;
14 RouteMessage::~RouteMessage() = default; 14 RouteMessage::~RouteMessage() = default;
15 15
16 std::string RouteMessage::ToHumanReadableString() const { 16 std::string RouteMessage::ToHumanReadableString() const {
17 if (!text && !binary) 17 if (!text && !binary)
18 return "null"; 18 return "null";
19 DCHECK((type == TEXT && text) || (type == BINARY && binary)); 19 DCHECK((type == TEXT && text) || (type == BINARY && binary));
20 std::string result; 20 std::string result;
21 if (text) { 21 if (text) {
22 result = "text="; 22 result = "text=";
23 base::EscapeJSONString(*text, true, &result); 23 base::EscapeJSONString(*text, true, &result);
24 } else { 24 } else {
25 const base::StringPiece src(reinterpret_cast<const char*>(binary->data()), 25 const base::StringPiece src(reinterpret_cast<const char*>(binary->data()),
26 binary->size()); 26 binary->size());
27 base::Base64Encode(src, &result); 27 base::Base64Encode(src, &result);
28 result = "binary=" + result; 28 result = "binary=" + result;
29 } 29 }
30 return result; 30 return result;
31 } 31 }
32 32
33 } // namespace media_router 33 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698