| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (_renderer) { | 158 if (_renderer) { |
| 159 _runtime->display_task_runner()->DeleteSoon(FROM_HERE, _renderer.release()); | 159 _runtime->display_task_runner()->DeleteSoon(FROM_HERE, _renderer.release()); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 #pragma mark - Eventing | 163 #pragma mark - Eventing |
| 164 | 164 |
| 165 - (void)hostSessionPinProvided:(NSNotification*)notification { | 165 - (void)hostSessionPinProvided:(NSNotification*)notification { |
| 166 NSString* pin = [[notification userInfo] objectForKey:kHostSessionPin]; | 166 NSString* pin = [[notification userInfo] objectForKey:kHostSessionPin]; |
| 167 if (_secretFetchedCallback) { | 167 if (_secretFetchedCallback) { |
| 168 remoting::protocol::SecretFetchedCallback callback = _secretFetchedCallback; |
| 168 _runtime->network_task_runner()->PostTask( | 169 _runtime->network_task_runner()->PostTask( |
| 169 FROM_HERE, base::BindBlockArc(^{ | 170 FROM_HERE, base::BindBlockArc(^{ |
| 170 _secretFetchedCallback.Run(base::SysNSStringToUTF8(pin)); | 171 callback.Run(base::SysNSStringToUTF8(pin)); |
| 171 })); | 172 })); |
| 173 _secretFetchedCallback.Reset(); |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 | 176 |
| 175 #pragma mark - Properties | 177 #pragma mark - Properties |
| 176 | 178 |
| 177 - (HostInfo*)hostInfo { | 179 - (HostInfo*)hostInfo { |
| 178 return _sessionDetails.hostInfo; | 180 return _sessionDetails.hostInfo; |
| 179 } | 181 } |
| 180 | 182 |
| 181 - (remoting::GestureInterpreter*)gestureInterpreter { | 183 - (remoting::GestureInterpreter*)gestureInterpreter { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 201 _sessionDetails.state = SessionAuthenticated; | 203 _sessionDetails.state = SessionAuthenticated; |
| 202 break; | 204 break; |
| 203 case remoting::protocol::ConnectionToHost::CONNECTED: | 205 case remoting::protocol::ConnectionToHost::CONNECTED: |
| 204 _sessionDetails.state = SessionConnected; | 206 _sessionDetails.state = SessionConnected; |
| 205 break; | 207 break; |
| 206 case remoting::protocol::ConnectionToHost::FAILED: | 208 case remoting::protocol::ConnectionToHost::FAILED: |
| 207 _sessionDetails.state = SessionFailed; | 209 _sessionDetails.state = SessionFailed; |
| 208 break; | 210 break; |
| 209 case remoting::protocol::ConnectionToHost::CLOSED: | 211 case remoting::protocol::ConnectionToHost::CLOSED: |
| 210 _sessionDetails.state = SessionClosed; | 212 _sessionDetails.state = SessionClosed; |
| 213 [self disconnectFromHost]; |
| 211 break; | 214 break; |
| 212 default: | 215 default: |
| 213 LOG(ERROR) << "onConnectionState, unknown state: " << state; | 216 LOG(ERROR) << "onConnectionState, unknown state: " << state; |
| 214 } | 217 } |
| 215 | 218 |
| 216 switch (error) { | 219 switch (error) { |
| 217 case remoting::protocol::ErrorCode::OK: | 220 case remoting::protocol::ErrorCode::OK: |
| 218 _sessionDetails.error = SessionErrorOk; | 221 _sessionDetails.error = SessionErrorOk; |
| 219 break; | 222 break; |
| 220 case remoting::protocol::ErrorCode::PEER_IS_OFFLINE: | 223 case remoting::protocol::ErrorCode::PEER_IS_OFFLINE: |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 NSLog(@"TODO(nicholss): implement this, commitPairingCredentialsForHost."); | 270 NSLog(@"TODO(nicholss): implement this, commitPairingCredentialsForHost."); |
| 268 } | 271 } |
| 269 | 272 |
| 270 - (void)fetchThirdPartyTokenForUrl:(NSString*)tokenUrl | 273 - (void)fetchThirdPartyTokenForUrl:(NSString*)tokenUrl |
| 271 clientId:(NSString*)clientId | 274 clientId:(NSString*)clientId |
| 272 scope:(NSString*)scope { | 275 scope:(NSString*)scope { |
| 273 NSLog(@"TODO(nicholss): implement this, fetchThirdPartyTokenForUrl."); | 276 NSLog(@"TODO(nicholss): implement this, fetchThirdPartyTokenForUrl."); |
| 274 } | 277 } |
| 275 | 278 |
| 276 - (void)setCapabilities:(NSString*)capabilities { | 279 - (void)setCapabilities:(NSString*)capabilities { |
| 277 NSLog(@"TODO(nicholss): implement this, setCapabilities."); | 280 NSLog(@"TODO(nicholss): implement this, setCapabilities. %@", capabilities); |
| 278 } | 281 } |
| 279 | 282 |
| 280 - (void)handleExtensionMessageOfType:(NSString*)type | 283 - (void)handleExtensionMessageOfType:(NSString*)type |
| 281 message:(NSString*)message { | 284 message:(NSString*)message { |
| 282 NSLog(@"TODO(nicholss): implement this, handleExtensionMessageOfType %@:%@.", | 285 NSLog(@"TODO(nicholss): implement this, handleExtensionMessageOfType %@:%@.", |
| 283 type, message); | 286 type, message); |
| 284 } | 287 } |
| 285 | 288 |
| 286 - (void)surfaceChanged:(const CGRect&)frame { | 289 - (void)surfaceChanged:(const CGRect&)frame { |
| 287 // Note that GLKView automatically sets the OpenGL viewport size to the size | 290 // Note that GLKView automatically sets the OpenGL viewport size to the size |
| 288 // of the surface. | 291 // of the surface. |
| 289 [_displayHandler onSurfaceChanged:frame]; | 292 [_displayHandler onSurfaceChanged:frame]; |
| 290 _gestureInterpreter->OnSurfaceSizeChanged(frame.size.width, | 293 _gestureInterpreter->OnSurfaceSizeChanged(frame.size.width, |
| 291 frame.size.height); | 294 frame.size.height); |
| 292 } | 295 } |
| 293 | 296 |
| 294 #pragma mark - GlDisplayHandlerDelegate | 297 #pragma mark - GlDisplayHandlerDelegate |
| 295 | 298 |
| 296 - (void)canvasSizeChanged:(CGSize)size { | 299 - (void)canvasSizeChanged:(CGSize)size { |
| 297 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); | 300 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); |
| 298 } | 301 } |
| 299 | 302 |
| 300 - (void)rendererTicked { | 303 - (void)rendererTicked { |
| 301 _gestureInterpreter->ProcessAnimations(); | 304 _gestureInterpreter->ProcessAnimations(); |
| 302 } | 305 } |
| 303 | 306 |
| 304 @end | 307 @end |
| OLD | NEW |