Chromium Code Reviews| Index: components/cast_channel/cast_channel_type.cc |
| diff --git a/components/cast_channel/cast_channel_type.cc b/components/cast_channel/cast_channel_type.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..65cfaf9564d8288688478988b0f755221d5f2316 |
| --- /dev/null |
| +++ b/components/cast_channel/cast_channel_type.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/cast_channel/cast_channel_type.h" |
| + |
| +namespace cast_channel { |
| + |
| +namespace { |
| +const char* kReadyStates[] = {"READY_STATE_NONE", "READY_STATE_CONNECTING", |
| + "READY_STATE_OPEN", "READY_STATE_CLOSING", |
| + "READY_STATE_CLOSED"}; |
| +const char* kChannelErrors[] = {"CHANNEL_ERROR_NONE", |
| + "CHANNEL_ERROR_CHANNEL_NOT_OPEN", |
| + "CHANNEL_ERROR_AUTHENTICATION_ERROR", |
| + "CHANNEL_ERROR_CONNECT_ERROR", |
| + "CHANNEL_ERROR_SOCKET_ERROR", |
| + "CHANNEL_ERROR_TRANSPORT_ERROR", |
| + "CHANNEL_ERROR_INVALID_MESSAGE", |
| + "CHANNEL_ERROR_INVALID_CHANNEL_ID", |
| + "CHANNEL_ERROR_CONNECT_TIMEOUT", |
| + "CHANNEL_ERROR_PING_TIMEOUT", |
| + "CHANNEL_ERROR_UNKNOWN"}; |
| +const char* kChannelAuthTypes[] = {"CHANNEL_AUTH_NONE", |
| + "CHANNEL_AUTH_SSL_VERIFIED"}; |
| +} |
|
imcheng
2017/05/24 22:11:23
} // namespace
zhaobin
2017/05/25 00:49:23
Code removed.
|
| + |
| +std::string ToString(ReadyState ready_state) { |
| + return kReadyStates[static_cast<int>(ready_state)]; |
|
imcheng
2017/05/24 22:11:23
This looks ok, but could be a problem if we added
mark a. foltz
2017/05/24 22:46:36
If these ToString methods are only for logging, th
zhaobin
2017/05/25 00:49:22
Done.
zhaobin
2017/05/25 00:49:23
Done.
|
| +} |
| + |
| +std::string ToString(ChannelError channel_error) { |
| + return kChannelErrors[static_cast<int>(channel_error)]; |
| +} |
| + |
| +std::string ToString(ChannelAuthType channel_auth) { |
| + return kChannelAuthTypes[static_cast<int>(channel_auth)]; |
| +} |
| + |
| +} // namespace cast_channel |