| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // TODO(nicholss): Add audio support to iOS. | 112 // TODO(nicholss): Add audio support to iOS. |
| 113 base::WeakPtr<remoting::protocol::AudioStub> audioPlayer = nullptr; | 113 base::WeakPtr<remoting::protocol::AudioStub> audioPlayer = nullptr; |
| 114 | 114 |
| 115 _displayHandler = [[GlDisplayHandler alloc] init]; | 115 _displayHandler = [[GlDisplayHandler alloc] init]; |
| 116 _displayHandler.delegate = self; | 116 _displayHandler.delegate = self; |
| 117 | 117 |
| 118 _session.reset(new remoting::ChromotingSession( | 118 _session.reset(new remoting::ChromotingSession( |
| 119 _sessonDelegate->GetWeakPtr(), [_displayHandler CreateCursorShapeStub], | 119 _sessonDelegate->GetWeakPtr(), [_displayHandler CreateCursorShapeStub], |
| 120 [_displayHandler CreateVideoRenderer], audioPlayer, info, | 120 [_displayHandler CreateVideoRenderer], audioPlayer, info, |
| 121 client_auth_config)); | 121 client_auth_config)); |
| 122 _session->Connect(); | |
| 123 | 122 |
| 124 __weak GlDisplayHandler* weakDisplayHandler = _displayHandler; | 123 __weak GlDisplayHandler* weakDisplayHandler = _displayHandler; |
| 125 _gestureInterpreter.reset(new remoting::GestureInterpreter( | 124 _gestureInterpreter.reset(new remoting::GestureInterpreter( |
| 126 base::BindBlockArc(^(const remoting::ViewMatrix& matrix) { | 125 base::BindBlockArc(^(const remoting::ViewMatrix& matrix) { |
| 127 [weakDisplayHandler onPixelTransformationChanged:matrix]; | 126 [weakDisplayHandler onPixelTransformationChanged:matrix]; |
| 128 }), | 127 }), |
| 129 _session.get())); | 128 _session.get())); |
| 129 |
| 130 _session->Connect(); |
| 130 } | 131 } |
| 131 | 132 |
| 132 - (void)disconnectFromHost { | 133 - (void)disconnectFromHost { |
| 133 if (_session) { | 134 if (_session) { |
| 134 _session->Disconnect(); | 135 _session->Disconnect(); |
| 135 } | 136 } |
| 136 _displayHandler = nil; | 137 _displayHandler = nil; |
| 137 // TODO(nicholss): Do we need to cleanup more? | 138 // TODO(nicholss): Do we need to cleanup more? |
| 138 } | 139 } |
| 139 | 140 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Note that GLKView automatically sets the OpenGL viewport size to the size | 227 // Note that GLKView automatically sets the OpenGL viewport size to the size |
| 227 // of the surface. | 228 // of the surface. |
| 228 [_displayHandler onSurfaceChanged:frame]; | 229 [_displayHandler onSurfaceChanged:frame]; |
| 229 _gestureInterpreter->OnSurfaceSizeChanged(frame.size.width, | 230 _gestureInterpreter->OnSurfaceSizeChanged(frame.size.width, |
| 230 frame.size.height); | 231 frame.size.height); |
| 231 } | 232 } |
| 232 | 233 |
| 233 #pragma mark - GlDisplayHandlerDelegate | 234 #pragma mark - GlDisplayHandlerDelegate |
| 234 | 235 |
| 235 - (void)canvasSizeChanged:(CGSize)size { | 236 - (void)canvasSizeChanged:(CGSize)size { |
| 236 if (_gestureInterpreter) { | 237 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); |
| 237 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); | 238 } |
| 238 } | 239 |
| 240 - (void)rendererTicked { |
| 241 _gestureInterpreter->ProcessAnimations(); |
| 239 } | 242 } |
| 240 | 243 |
| 241 @end | 244 @end |
| OLD | NEW |