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

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

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "extensions/common/api/cast_channel.h" 11 #include "extensions/common/api/cast_channel.h"
12 #include "extensions/common/api/cast_channel/cast_channel.pb.h" 12 #include "extensions/common/api/cast_channel/cast_channel.pb.h"
13 13
14 namespace { 14 namespace {
15 static const char kAuthNamespace[] = 15 static const char kAuthNamespace[] =
16 "urn:x-cast:com.google.cast.tp.deviceauth"; 16 "urn:x-cast:com.google.cast.tp.deviceauth";
17 // Sender and receiver IDs to use for platform messages. 17 // Sender and receiver IDs to use for platform messages.
18 static const char kPlatformSenderId[] = "sender-0"; 18 static const char kPlatformSenderId[] = "sender-0";
19 static const char kPlatformReceiverId[] = "receiver-0"; 19 static const char kPlatformReceiverId[] = "receiver-0";
20 } // namespace 20 } // namespace
21 21
22 namespace extensions { 22 namespace extensions {
23 namespace core_api { 23 namespace api {
24 namespace cast_channel { 24 namespace cast_channel {
25 25
26 bool MessageInfoToCastMessage(const MessageInfo& message, 26 bool MessageInfoToCastMessage(const MessageInfo& message,
27 CastMessage* message_proto) { 27 CastMessage* message_proto) {
28 DCHECK(message_proto); 28 DCHECK(message_proto);
29 if (!message.data) 29 if (!message.data)
30 return false; 30 return false;
31 31
32 message_proto->set_protocol_version(CastMessage_ProtocolVersion_CASTV2_1_0); 32 message_proto->set_protocol_version(CastMessage_ProtocolVersion_CASTV2_1_0);
33 message_proto->set_source_id(message.source_id); 33 message_proto->set_source_id(message.source_id);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 message_proto->set_namespace_(kAuthNamespace); 150 message_proto->set_namespace_(kAuthNamespace);
151 message_proto->set_payload_type(CastMessage_PayloadType_BINARY); 151 message_proto->set_payload_type(CastMessage_PayloadType_BINARY);
152 message_proto->set_payload_binary(auth_message_string); 152 message_proto->set_payload_binary(auth_message_string);
153 } 153 }
154 154
155 bool IsAuthMessage(const CastMessage& message) { 155 bool IsAuthMessage(const CastMessage& message) {
156 return message.namespace_() == kAuthNamespace; 156 return message.namespace_() == kAuthNamespace;
157 } 157 }
158 158
159 } // namespace cast_channel 159 } // namespace cast_channel
160 } // namespace core_api 160 } // namespace api
161 } // namespace extensions 161 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_message_util.h ('k') | extensions/browser/api/cast_channel/cast_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698