OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #if defined(OS_NACL) | 10 #if defined(OS_NACL) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 const int kBandwidthHistogramBuckets = 100; | 91 const int kBandwidthHistogramBuckets = 100; |
92 | 92 |
93 #if defined(USE_OPENSSL) | 93 #if defined(USE_OPENSSL) |
94 // Size of the random seed blob used to initialize RNG in libjingle. Libjingle | 94 // Size of the random seed blob used to initialize RNG in libjingle. Libjingle |
95 // uses the seed only for OpenSSL builds. OpenSSL needs at least 32 bytes of | 95 // uses the seed only for OpenSSL builds. OpenSSL needs at least 32 bytes of |
96 // entropy (see http://wiki.openssl.org/index.php/Random_Numbers), but stores | 96 // entropy (see http://wiki.openssl.org/index.php/Random_Numbers), but stores |
97 // 1039 bytes of state, so we initialize it with 1k or random data. | 97 // 1039 bytes of state, so we initialize it with 1k or random data. |
98 const int kRandomSeedSize = 1024; | 98 const int kRandomSeedSize = 1024; |
99 #endif // defined(USE_OPENSSL) | 99 #endif // defined(USE_OPENSSL) |
100 | 100 |
101 std::string ConnectionStateToString(protocol::ConnectionToHost::State state) { | |
tonychun
2015/07/29 18:30:33
Since this functionality exists in remoting/protoc
| |
102 // Values returned by this function must match the | |
103 // remoting.ClientSession.State enum in JS code. | |
104 switch (state) { | |
105 case protocol::ConnectionToHost::INITIALIZING: | |
106 return "INITIALIZING"; | |
107 case protocol::ConnectionToHost::CONNECTING: | |
108 return "CONNECTING"; | |
109 case protocol::ConnectionToHost::AUTHENTICATED: | |
110 return "AUTHENTICATED"; | |
111 case protocol::ConnectionToHost::CONNECTED: | |
112 return "CONNECTED"; | |
113 case protocol::ConnectionToHost::CLOSED: | |
114 return "CLOSED"; | |
115 case protocol::ConnectionToHost::FAILED: | |
116 return "FAILED"; | |
117 } | |
118 NOTREACHED(); | |
119 return std::string(); | |
120 } | |
121 | |
122 // TODO(sergeyu): Ideally we should just pass ErrorCode to the webapp | 101 // TODO(sergeyu): Ideally we should just pass ErrorCode to the webapp |
123 // and let it handle it, but it would be hard to fix it now because | 102 // and let it handle it, but it would be hard to fix it now because |
124 // client plugin and webapp versions may not be in sync. It should be | 103 // client plugin and webapp versions may not be in sync. It should be |
125 // easy to do after we are finished moving the client plugin to NaCl. | 104 // easy to do after we are finished moving the client plugin to NaCl. |
126 std::string ConnectionErrorToString(protocol::ErrorCode error) { | 105 std::string ConnectionErrorToString(protocol::ErrorCode error) { |
127 // Values returned by this function must match the | 106 // Values returned by this function must match the |
128 // remoting.ClientSession.Error enum in JS code. | 107 // remoting.ClientSession.Error enum in JS code. |
129 switch (error) { | 108 switch (error) { |
130 case protocol::OK: | 109 case protocol::OK: |
131 return "NONE"; | 110 return "NONE"; |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1232 | 1211 |
1233 #if !defined(OS_NACL) | 1212 #if !defined(OS_NACL) |
1234 // Log messages are forwarded to the webapp only in PNaCl version of the | 1213 // Log messages are forwarded to the webapp only in PNaCl version of the |
1235 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl | 1214 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl |
1236 // version. | 1215 // version. |
1237 ProcessLogToUI(message); | 1216 ProcessLogToUI(message); |
1238 #endif // !defined(OS_NACL) | 1217 #endif // !defined(OS_NACL) |
1239 } | 1218 } |
1240 | 1219 |
1241 } // namespace remoting | 1220 } // namespace remoting |
OLD | NEW |