Chromium Code Reviews| 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/client/ios/session/remoting_client.h" | 9 #import "remoting/client/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 // TODO(nicholss): Do we need to cleanup more? | 137 // TODO(nicholss): Do we need to cleanup more? |
| 137 } | 138 } |
| 138 | 139 |
| 139 #pragma mark - Eventing | 140 #pragma mark - Eventing |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 | 224 |
| 224 - (void)surfaceChanged:(const CGRect&)frame { | 225 - (void)surfaceChanged:(const CGRect&)frame { |
| 225 [_displayHandler onSurfaceChanged:frame]; | 226 [_displayHandler onSurfaceChanged:frame]; |
| 226 _gestureInterpreter->OnSurfaceSizeChanged(frame.size.width, | 227 _gestureInterpreter->OnSurfaceSizeChanged(frame.size.width, |
| 227 frame.size.height); | 228 frame.size.height); |
| 228 } | 229 } |
| 229 | 230 |
| 230 #pragma mark - GlDisplayHandlerDelegate | 231 #pragma mark - GlDisplayHandlerDelegate |
| 231 | 232 |
| 232 - (void)canvasSizeChanged:(CGSize)size { | 233 - (void)canvasSizeChanged:(CGSize)size { |
| 233 if (_gestureInterpreter) { | 234 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); |
|
Yuwei
2017/05/10 06:53:03
Removed the check since canvasSizeChanged will onl
| |
| 234 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); | 235 } |
| 235 } | 236 |
| 237 - (void)rendererTicked { | |
| 238 _gestureInterpreter->ProcessAnimations(); | |
| 236 } | 239 } |
| 237 | 240 |
| 238 @end | 241 @end |
| OLD | NEW |