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

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: rename cast_channel_type to cast_channel_enum 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
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 default:
imcheng 2017/05/26 17:43:36 Maybe get rid of the default case? It will help us
zhaobin 2017/05/27 03:08:38 Done.
24 NOTREACHED();
mark a. foltz 2017/05/26 16:56:42 Also << "Unknown ready_state " << ready_state her
zhaobin 2017/05/27 03:08:38 Done.
25 }
26 }
27
28 std::string ChannelErrorToString(ChannelError channel_error) {
29 switch (channel_error) {
30 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::NONE);
31 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CHANNEL_NOT_OPEN);
32 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::AUTHENTICATION_ERROR);
33 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CONNECT_ERROR);
34 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::SOCKET_ERROR);
35 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::TRANSPORT_ERROR);
36 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::INVALID_MESSAGE);
37 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::INVALID_CHANNEL_ID);
38 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::CONNECT_TIMEOUT);
39 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::PING_TIMEOUT);
40 CAST_CHANNEL_TYPE_TO_STRING(ChannelError::UNKNOWN);
41
42 default:
43 NOTREACHED();
44 }
45 }
46
47 std::string ChannelAuthTypeToString(ChannelAuthType channel_auth) {
48 switch (channel_auth) {
49 CAST_CHANNEL_TYPE_TO_STRING(ChannelAuthType::NONE);
50 CAST_CHANNEL_TYPE_TO_STRING(ChannelAuthType::SSL_VERIFIED);
51 default:
52 NOTREACHED();
53 }
54 }
55
56 } // namespace cast_channel
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698