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

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

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 MessageInfo* message) { 74 MessageInfo* message) {
75 DCHECK(message); 75 DCHECK(message);
76 message->source_id = message_proto.source_id(); 76 message->source_id = message_proto.source_id();
77 message->destination_id = message_proto.destination_id(); 77 message->destination_id = message_proto.destination_id();
78 message->namespace_ = message_proto.namespace_(); 78 message->namespace_ = message_proto.namespace_();
79 // Determine the type of the payload and fill base::Value appropriately. 79 // Determine the type of the payload and fill base::Value appropriately.
80 std::unique_ptr<base::Value> value; 80 std::unique_ptr<base::Value> value;
81 switch (message_proto.payload_type()) { 81 switch (message_proto.payload_type()) {
82 case CastMessage_PayloadType_STRING: 82 case CastMessage_PayloadType_STRING:
83 if (message_proto.has_payload_utf8()) 83 if (message_proto.has_payload_utf8())
84 value.reset(new base::StringValue(message_proto.payload_utf8())); 84 value.reset(new base::Value(message_proto.payload_utf8()));
85 break; 85 break;
86 case CastMessage_PayloadType_BINARY: 86 case CastMessage_PayloadType_BINARY:
87 if (message_proto.has_payload_binary()) 87 if (message_proto.has_payload_binary())
88 value = base::BinaryValue::CreateWithCopiedBuffer( 88 value = base::BinaryValue::CreateWithCopiedBuffer(
89 message_proto.payload_binary().data(), 89 message_proto.payload_binary().data(),
90 message_proto.payload_binary().size()); 90 message_proto.payload_binary().size());
91 break; 91 break;
92 default: 92 default:
93 // Unknown payload type. value will remain unset. 93 // Unknown payload type. value will remain unset.
94 break; 94 break;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 message_proto->set_payload_binary(auth_message_string); 149 message_proto->set_payload_binary(auth_message_string);
150 } 150 }
151 151
152 bool IsAuthMessage(const CastMessage& message) { 152 bool IsAuthMessage(const CastMessage& message) {
153 return message.namespace_() == kAuthNamespace; 153 return message.namespace_() == kAuthNamespace;
154 } 154 }
155 155
156 } // namespace cast_channel 156 } // namespace cast_channel
157 } // namespace api 157 } // namespace api
158 } // namespace extensions 158 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/app_window/app_window_api.cc ('k') | extensions/browser/api/declarative/declarative_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698