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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_enum_util.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, 6 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 "extensions/browser/api/cast_channel/cast_channel_enum_util.h"
6
7 namespace extensions {
8 namespace api {
9 namespace cast_channel {
10
11 api::cast_channel::ReadyState ToReadyState(
12 ::cast_channel::ReadyState ready_state) {
13 switch (ready_state) {
14 case ::cast_channel::ReadyState::NONE:
15 return READY_STATE_NONE;
16 case ::cast_channel::ReadyState::CONNECTING:
17 return READY_STATE_CONNECTING;
18 case ::cast_channel::ReadyState::OPEN:
19 return READY_STATE_OPEN;
20 case ::cast_channel::ReadyState::CLOSING:
21 return READY_STATE_CLOSING;
22 case ::cast_channel::ReadyState::CLOSED:
23 return READY_STATE_CLOSED;
24 default:
25 NOTREACHED();
mark a. foltz 2017/05/26 16:55:51 << "Unknown ready_state " << ready_state Here and
zhaobin 2017/05/27 03:08:38 Done.
26 return READY_STATE_NONE;
27 }
28 }
29
30 api::cast_channel::ChannelError ToChannelError(
31 ::cast_channel::ChannelError channel_error) {
32 switch (channel_error) {
33 case ::cast_channel::ChannelError::NONE:
34 return CHANNEL_ERROR_NONE;
35 case ::cast_channel::ChannelError::CHANNEL_NOT_OPEN:
36 return CHANNEL_ERROR_CHANNEL_NOT_OPEN;
37 case ::cast_channel::ChannelError::AUTHENTICATION_ERROR:
38 return CHANNEL_ERROR_AUTHENTICATION_ERROR;
39 case ::cast_channel::ChannelError::CONNECT_ERROR:
40 return CHANNEL_ERROR_CONNECT_ERROR;
41 case ::cast_channel::ChannelError::SOCKET_ERROR:
42 return CHANNEL_ERROR_SOCKET_ERROR;
43 case ::cast_channel::ChannelError::TRANSPORT_ERROR:
44 return CHANNEL_ERROR_TRANSPORT_ERROR;
45 case ::cast_channel::ChannelError::INVALID_MESSAGE:
46 return CHANNEL_ERROR_INVALID_MESSAGE;
47 case ::cast_channel::ChannelError::INVALID_CHANNEL_ID:
48 return CHANNEL_ERROR_INVALID_CHANNEL_ID;
49 case ::cast_channel::ChannelError::CONNECT_TIMEOUT:
50 return CHANNEL_ERROR_CONNECT_TIMEOUT;
51 case ::cast_channel::ChannelError::PING_TIMEOUT:
52 return CHANNEL_ERROR_PING_TIMEOUT;
53 case ::cast_channel::ChannelError::UNKNOWN:
54 return CHANNEL_ERROR_UNKNOWN;
55 default:
56 NOTREACHED();
57 return CHANNEL_ERROR_NONE;
58 }
59 }
60
61 api::cast_channel::ChannelAuthType ToChannelAuthType(
62 ::cast_channel::ChannelAuthType channel_auth) {
63 switch (channel_auth) {
64 case ::cast_channel::ChannelAuthType::NONE:
65 return CHANNEL_AUTH_TYPE_NONE;
66 case ::cast_channel::ChannelAuthType::SSL_VERIFIED:
67 return CHANNEL_AUTH_TYPE_SSL_VERIFIED;
68 default:
69 NOTREACHED();
70 return CHANNEL_AUTH_TYPE_NONE;
71 }
72 }
73
74 ::cast_channel::ChannelAuthType ToChannelAuthTypeInternal(
75 api::cast_channel::ChannelAuthType channel_auth) {
76 switch (channel_auth) {
77 case CHANNEL_AUTH_TYPE_NONE:
78 return ::cast_channel::ChannelAuthType::NONE;
79 case CHANNEL_AUTH_TYPE_SSL_VERIFIED:
80 return ::cast_channel::ChannelAuthType::SSL_VERIFIED;
81 default:
82 NOTREACHED();
83 return ::cast_channel::ChannelAuthType::NONE;
84 }
85 }
86
87 } // namespace cast_channel
88 } // namespace api
89 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698