| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_CAST_CHANNEL_CAST_CHANNEL_ENUM_H_ | 5 #ifndef COMPONENTS_CAST_CHANNEL_CAST_CHANNEL_ENUM_H_ |
| 6 #define COMPONENTS_CAST_CHANNEL_CAST_CHANNEL_ENUM_H_ | 6 #define COMPONENTS_CAST_CHANNEL_CAST_CHANNEL_ENUM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace cast_channel { | 10 namespace cast_channel { |
| 11 | 11 |
| 12 // Helper function to convert scoped enums to their underlying type, for use | 12 // Helper function to convert scoped enums to their underlying type, for use |
| 13 // with ostreams. | 13 // with ostreams. |
| 14 template <typename Enumeration> | 14 template <typename Enumeration> |
| 15 auto AsInteger(Enumeration const value) -> | 15 auto AsInteger(Enumeration const value) -> |
| 16 typename std::underlying_type<Enumeration>::type { | 16 typename std::underlying_type<Enumeration>::type { |
| 17 return static_cast<typename std::underlying_type<Enumeration>::type>(value); | 17 return static_cast<typename std::underlying_type<Enumeration>::type>(value); |
| 18 } | 18 } |
| 19 | 19 |
| 20 // Maps to enum ReadyState in cast_channel.idl | 20 // Maps to enum ReadyState in cast_channel.idl |
| 21 enum class ReadyState { | 21 enum class ReadyState { |
| 22 NONE, | 22 NONE, |
| 23 CONNECTING, | 23 CONNECTING, |
| 24 OPEN, | 24 OPEN, |
| 25 CLOSING, | 25 CLOSING, // TODO(zhaobin): Remove this value because it is unused. |
| 26 CLOSED, | 26 CLOSED, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Maps to enum ChannelError in cast_channel.idl | 29 // Maps to enum ChannelError in cast_channel.idl |
| 30 enum class ChannelError { | 30 enum class ChannelError { |
| 31 NONE, | 31 NONE, |
| 32 CHANNEL_NOT_OPEN, | 32 CHANNEL_NOT_OPEN, |
| 33 AUTHENTICATION_ERROR, | 33 AUTHENTICATION_ERROR, |
| 34 CONNECT_ERROR, | 34 CONNECT_ERROR, |
| 35 CAST_SOCKET_ERROR, | 35 CAST_SOCKET_ERROR, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 WRITE_ERROR, // Terminal states here and below. | 135 WRITE_ERROR, // Terminal states here and below. |
| 136 IDLE, | 136 IDLE, |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 std::string ReadyStateToString(ReadyState ready_state); | 139 std::string ReadyStateToString(ReadyState ready_state); |
| 140 std::string ChannelErrorToString(ChannelError channel_error); | 140 std::string ChannelErrorToString(ChannelError channel_error); |
| 141 | 141 |
| 142 } // namespace cast_channel | 142 } // namespace cast_channel |
| 143 | 143 |
| 144 #endif // COMPONENTS_CAST_CHANNEL_CAST_CHANNEL_ENUM_H_ | 144 #endif // COMPONENTS_CAST_CHANNEL_CAST_CHANNEL_ENUM_H_ |
| OLD | NEW |