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

Side by Side Diff: components/cast_channel/cast_channel_enum.cc

Issue 2891923004: [cast_channel] Make cast_channel related files not depend on "cast_channel.h" (Closed)
Patch Set: fix windows compile errors Created 3 years, 7 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
« no previous file with comments | « components/cast_channel/cast_channel_enum.h ('k') | extensions/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/cast_channel/cast_channel_enum.h"
6
7 #include "base/logging.h"
8
9 namespace cast_channel {
10
11 #define CAST_CHANNEL_TYPE_TO_STRING(enum) \
12 case enum: \
13 return #enum
14
15 std::string ReadyStateToString(ReadyState ready_state) {
16 switch (ready_state) {
17 CAST_CHANNEL_TYPE_TO_STRING(ReadyState::NONE);
18 CAST_CHANNEL_TYPE_TO_STRING(ReadyState::CONNECTING);
19 CAST_CHANNEL_TYPE_TO_STRING(ReadyState::OPEN);
20 CAST_CHANNEL_TYPE_TO_STRING(ReadyState::CLOSING);
21 CAST_CHANNEL_TYPE_TO_STRING(ReadyState::CLOSED);
22 }
23 NOTREACHED() << "Unknown ready_state " << ReadyStateToString(ready_state);
24 return "Unknown ready_state";
25 }
26
27 std::string ChannelErrorToString(ChannelError channel_error) {
28 switch (channel_error) {
29 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::NONE);
30 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CHANNEL_NOT_OPEN);
31 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::AUTHENTICATION_ERROR);
32 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CONNECT_ERROR);
33 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CAST_SOCKET_ERROR);
34 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::TRANSPORT_ERROR);
35 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::INVALID_MESSAGE);
36 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::INVALID_CHANNEL_ID);
37 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CONNECT_TIMEOUT);
38 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::PING_TIMEOUT);
39 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::UNKNOWN);
40 }
41 NOTREACHED() << "Unknown channel_error "
42 << ChannelErrorToString(channel_error);
43 return "Unknown channel_error";
44 }
45
46 std::string ChannelAuthTypeToString(ChannelAuthType channel_auth) {
47 switch (channel_auth) {
48 CAST_CHANNEL_TYPE_TO_STRING(ChannelAuthType::NONE);
49 CAST_CHANNEL_TYPE_TO_STRING(ChannelAuthType::SSL_VERIFIED);
50 }
51 NOTREACHED() << "Unknown channel_auth "
52 << ChannelAuthTypeToString(channel_auth);
53 return "Unknown channel_auth";
54 }
55
56 } // namespace cast_channel
OLDNEW
« no previous file with comments | « components/cast_channel/cast_channel_enum.h ('k') | extensions/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698