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

Side by Side Diff: extensions/browser/api/cast_channel/cast_message_util.cc

Issue 2799093006: Remove base::BinaryValue (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_message_util.h" 5 #include "extensions/browser/api/cast_channel/cast_message_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 message->namespace_ = message_proto.namespace_(); 79 message->namespace_ = message_proto.namespace_();
80 // Determine the type of the payload and fill base::Value appropriately. 80 // Determine the type of the payload and fill base::Value appropriately.
81 std::unique_ptr<base::Value> value; 81 std::unique_ptr<base::Value> value;
82 switch (message_proto.payload_type()) { 82 switch (message_proto.payload_type()) {
83 case CastMessage_PayloadType_STRING: 83 case CastMessage_PayloadType_STRING:
84 if (message_proto.has_payload_utf8()) 84 if (message_proto.has_payload_utf8())
85 value.reset(new base::Value(message_proto.payload_utf8())); 85 value.reset(new base::Value(message_proto.payload_utf8()));
86 break; 86 break;
87 case CastMessage_PayloadType_BINARY: 87 case CastMessage_PayloadType_BINARY:
88 if (message_proto.has_payload_binary()) 88 if (message_proto.has_payload_binary())
89 value = base::BinaryValue::CreateWithCopiedBuffer( 89 value = base::Value::CreateWithCopiedBuffer(
90 message_proto.payload_binary().data(), 90 message_proto.payload_binary().data(),
91 message_proto.payload_binary().size()); 91 message_proto.payload_binary().size());
92 break; 92 break;
93 default: 93 default:
94 // Unknown payload type. value will remain unset. 94 // Unknown payload type. value will remain unset.
95 break; 95 break;
96 } 96 }
97 if (value.get()) { 97 if (value.get()) {
98 DCHECK(!message->data.get()); 98 DCHECK(!message->data.get());
99 message->data = std::move(value); 99 message->data = std::move(value);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 message_proto->set_payload_binary(auth_message_string); 151 message_proto->set_payload_binary(auth_message_string);
152 } 152 }
153 153
154 bool IsAuthMessage(const CastMessage& message) { 154 bool IsAuthMessage(const CastMessage& message) {
155 return message.namespace_() == kAuthNamespace; 155 return message.namespace_() == kAuthNamespace;
156 } 156 }
157 157
158 } // namespace cast_channel 158 } // namespace cast_channel
159 } // namespace api 159 } // namespace api
160 } // namespace extensions 160 } // namespace extensions
OLDNEW
« no previous file with comments | « content/common/android/gin_java_bridge_value_unittest.cc ('k') | extensions/browser/api/declarative/declarative_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698