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 #if !defined(__has_feature) || !__has_feature(objc_arc) | 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
6 #error "This file requires ARC support." | 6 #error "This file requires ARC support." |
7 #endif | 7 #endif |
8 | 8 |
9 #import "remoting/ios/session/remoting_client.h" | 9 #import "remoting/ios/session/remoting_client.h" |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 - (remoting::KeyboardInterpreter*)keyboardInterpreter { | 185 - (remoting::KeyboardInterpreter*)keyboardInterpreter { |
186 return _keyboardInterpreter.get(); | 186 return _keyboardInterpreter.get(); |
187 } | 187 } |
188 | 188 |
189 #pragma mark - ChromotingSession::Delegate | 189 #pragma mark - ChromotingSession::Delegate |
190 | 190 |
191 - (void)onConnectionState:(remoting::protocol::ConnectionToHost::State)state | 191 - (void)onConnectionState:(remoting::protocol::ConnectionToHost::State)state |
192 error:(remoting::protocol::ErrorCode)error { | 192 error:(remoting::protocol::ErrorCode)error { |
193 switch (state) { | 193 switch (state) { |
194 case remoting::protocol::ConnectionToHost::INITIALIZING: | 194 case remoting::protocol::ConnectionToHost::INITIALIZING: |
195 NSLog(@"State --> INITIALIZING"); | |
196 _sessionDetails.state = SessionInitializing; | 195 _sessionDetails.state = SessionInitializing; |
197 break; | 196 break; |
198 case remoting::protocol::ConnectionToHost::CONNECTING: | 197 case remoting::protocol::ConnectionToHost::CONNECTING: |
199 NSLog(@"State --> CONNECTING"); | |
200 _sessionDetails.state = SessionConnecting; | 198 _sessionDetails.state = SessionConnecting; |
201 break; | 199 break; |
202 case remoting::protocol::ConnectionToHost::AUTHENTICATED: | 200 case remoting::protocol::ConnectionToHost::AUTHENTICATED: |
203 NSLog(@"State --> AUTHENTICATED"); | |
204 _sessionDetails.state = SessionAuthenticated; | 201 _sessionDetails.state = SessionAuthenticated; |
205 break; | 202 break; |
206 case remoting::protocol::ConnectionToHost::CONNECTED: | 203 case remoting::protocol::ConnectionToHost::CONNECTED: |
207 NSLog(@"State --> CONNECTED"); | |
208 _sessionDetails.state = SessionConnected; | 204 _sessionDetails.state = SessionConnected; |
209 break; | 205 break; |
210 case remoting::protocol::ConnectionToHost::FAILED: | 206 case remoting::protocol::ConnectionToHost::FAILED: |
211 NSLog(@"State --> FAILED"); | |
212 _sessionDetails.state = SessionFailed; | 207 _sessionDetails.state = SessionFailed; |
213 break; | 208 break; |
214 case remoting::protocol::ConnectionToHost::CLOSED: | 209 case remoting::protocol::ConnectionToHost::CLOSED: |
215 NSLog(@"State --> CLOSED"); | |
216 _sessionDetails.state = SessionClosed; | 210 _sessionDetails.state = SessionClosed; |
217 break; | 211 break; |
218 default: | 212 default: |
219 LOG(ERROR) << "onConnectionState, unknown state: " << state; | 213 LOG(ERROR) << "onConnectionState, unknown state: " << state; |
220 } | 214 } |
221 | 215 |
222 // TODO(nicholss): Send along the error code when we know what to do about it. | 216 switch (error) { |
| 217 case remoting::protocol::ErrorCode::OK: |
| 218 _sessionDetails.error = SessionErrorOk; |
| 219 break; |
| 220 case remoting::protocol::ErrorCode::PEER_IS_OFFLINE: |
| 221 _sessionDetails.error = SessionErrorPeerIsOffline; |
| 222 break; |
| 223 case remoting::protocol::ErrorCode::SESSION_REJECTED: |
| 224 _sessionDetails.error = SessionErrorSessionRejected; |
| 225 break; |
| 226 case remoting::protocol::ErrorCode::INCOMPATIBLE_PROTOCOL: |
| 227 _sessionDetails.error = SessionErrorIncompatibleProtocol; |
| 228 break; |
| 229 case remoting::protocol::ErrorCode::AUTHENTICATION_FAILED: |
| 230 _sessionDetails.error = SessionErrorAuthenticationFailed; |
| 231 break; |
| 232 case remoting::protocol::ErrorCode::INVALID_ACCOUNT: |
| 233 _sessionDetails.error = SessionErrorInvalidAccount; |
| 234 break; |
| 235 case remoting::protocol::ErrorCode::CHANNEL_CONNECTION_ERROR: |
| 236 _sessionDetails.error = SessionErrorChannelConnectionError; |
| 237 break; |
| 238 case remoting::protocol::ErrorCode::SIGNALING_ERROR: |
| 239 _sessionDetails.error = SessionErrorSignalingError; |
| 240 break; |
| 241 case remoting::protocol::ErrorCode::SIGNALING_TIMEOUT: |
| 242 _sessionDetails.error = SessionErrorSignalingTimeout; |
| 243 break; |
| 244 case remoting::protocol::ErrorCode::HOST_OVERLOAD: |
| 245 _sessionDetails.error = SessionErrorHostOverload; |
| 246 break; |
| 247 case remoting::protocol::ErrorCode::MAX_SESSION_LENGTH: |
| 248 _sessionDetails.error = SessionErrorMaxSessionLength; |
| 249 break; |
| 250 case remoting::protocol::ErrorCode::HOST_CONFIGURATION_ERROR: |
| 251 _sessionDetails.error = SessionErrorHostConfigurationError; |
| 252 case remoting::protocol::ErrorCode::UNKNOWN_ERROR: |
| 253 _sessionDetails.error = SessionErrorUnknownError; |
| 254 break; |
| 255 } |
| 256 |
223 [[NSNotificationCenter defaultCenter] | 257 [[NSNotificationCenter defaultCenter] |
224 postNotificationName:kHostSessionStatusChanged | 258 postNotificationName:kHostSessionStatusChanged |
225 object:self | 259 object:self |
226 userInfo:[NSDictionary dictionaryWithObject:_sessionDetails | 260 userInfo:[NSDictionary dictionaryWithObject:_sessionDetails |
227 forKey:kSessionDetails]]; | 261 forKey:kSessionDetails]]; |
228 } | 262 } |
229 | 263 |
230 - (void)commitPairingCredentialsForHost:(NSString*)host | 264 - (void)commitPairingCredentialsForHost:(NSString*)host |
231 id:(NSString*)id | 265 id:(NSString*)id |
232 secret:(NSString*)secret { | 266 secret:(NSString*)secret { |
(...skipping 28 matching lines...) Expand all Loading... |
261 | 295 |
262 - (void)canvasSizeChanged:(CGSize)size { | 296 - (void)canvasSizeChanged:(CGSize)size { |
263 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); | 297 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); |
264 } | 298 } |
265 | 299 |
266 - (void)rendererTicked { | 300 - (void)rendererTicked { |
267 _gestureInterpreter->ProcessAnimations(); | 301 _gestureInterpreter->ProcessAnimations(); |
268 } | 302 } |
269 | 303 |
270 @end | 304 @end |
OLD | NEW |