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

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

Issue 2841623003: Remove base::Value::Get{Buffer,Size} (Closed)
Patch Set: std::vector::assign instead of std::vector::operator= 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // JS string 42 // JS string
43 case base::Value::Type::STRING: 43 case base::Value::Type::STRING:
44 if (message.data->GetAsString(&data)) { 44 if (message.data->GetAsString(&data)) {
45 message_proto->set_payload_type(CastMessage_PayloadType_STRING); 45 message_proto->set_payload_type(CastMessage_PayloadType_STRING);
46 message_proto->set_payload_utf8(data); 46 message_proto->set_payload_utf8(data);
47 } 47 }
48 break; 48 break;
49 // JS ArrayBuffer 49 // JS ArrayBuffer
50 case base::Value::Type::BINARY: 50 case base::Value::Type::BINARY:
51 message_proto->set_payload_type(CastMessage_PayloadType_BINARY); 51 message_proto->set_payload_type(CastMessage_PayloadType_BINARY);
52 message_proto->set_payload_binary(message.data->GetBuffer(), 52 message_proto->set_payload_binary(message.data->GetBlob().data(),
53 message.data->GetSize()); 53 message.data->GetBlob().size());
54 break; 54 break;
55 default: 55 default:
56 // Unknown value type. message_proto will remain uninitialized because 56 // Unknown value type. message_proto will remain uninitialized because
57 // payload_type is unset. 57 // payload_type is unset.
58 break; 58 break;
59 } 59 }
60 return message_proto->IsInitialized(); 60 return message_proto->IsInitialized();
61 } 61 }
62 62
63 bool IsCastMessageValid(const CastMessage& message_proto) { 63 bool IsCastMessageValid(const CastMessage& message_proto) {
(...skipping 87 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.cc ('k') | extensions/browser/api/declarative/declarative_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698