Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1768)

Side by Side Diff: remoting/ios/session/remoting_client.mm

Issue 2868383003: [CRD iOS] Send key events to the session. (Closed)
Patch Set: Clean up old key input code. No longer used. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include <memory> 11 #include <memory>
12 12
13 #import "base/mac/bind_objc_block.h" 13 #import "base/mac/bind_objc_block.h"
14 #import "ios/third_party/material_components_ios/src/components/Dialogs/src/Mate rialDialogs.h" 14 #import "ios/third_party/material_components_ios/src/components/Dialogs/src/Mate rialDialogs.h"
15 #import "remoting/ios/display/gl_display_handler.h" 15 #import "remoting/ios/display/gl_display_handler.h"
16 #import "remoting/ios/domain/client_session_details.h" 16 #import "remoting/ios/domain/client_session_details.h"
17 #import "remoting/ios/domain/host_info.h" 17 #import "remoting/ios/domain/host_info.h"
18 18
19 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
20 #include "remoting/client/chromoting_client_runtime.h" 20 #include "remoting/client/chromoting_client_runtime.h"
21 #include "remoting/client/chromoting_session.h" 21 #include "remoting/client/chromoting_session.h"
22 #include "remoting/client/connect_to_host_info.h" 22 #include "remoting/client/connect_to_host_info.h"
23 #include "remoting/client/gesture_interpreter.h" 23 #include "remoting/client/gesture_interpreter.h"
24 #include "remoting/client/input/keyboard_interpreter.h"
24 #include "remoting/ios/session/remoting_client_session_delegate.h" 25 #include "remoting/ios/session/remoting_client_session_delegate.h"
25 #include "remoting/protocol/session.h" 26 #include "remoting/protocol/session.h"
26 #include "remoting/protocol/video_renderer.h" 27 #include "remoting/protocol/video_renderer.h"
27 28
28 NSString* const kHostSessionStatusChanged = @"kHostSessionStatusChanged"; 29 NSString* const kHostSessionStatusChanged = @"kHostSessionStatusChanged";
29 NSString* const kHostSessionPinProvided = @"kHostSessionPinProvided"; 30 NSString* const kHostSessionPinProvided = @"kHostSessionPinProvided";
30 31
31 NSString* const kSessionDetails = @"kSessionDetails"; 32 NSString* const kSessionDetails = @"kSessionDetails";
32 NSString* const kSessonStateErrorCode = @"kSessonStateErrorCode"; 33 NSString* const kSessonStateErrorCode = @"kSessonStateErrorCode";
33 NSString* const kHostSessionPin = @"kHostSessionPin"; 34 NSString* const kHostSessionPin = @"kHostSessionPin";
34 35
35 @interface RemotingClient () { 36 @interface RemotingClient () {
36 remoting::ChromotingClientRuntime* _runtime; 37 remoting::ChromotingClientRuntime* _runtime;
37 std::unique_ptr<remoting::ChromotingSession> _session; 38 std::unique_ptr<remoting::ChromotingSession> _session;
38 remoting::RemotingClientSessonDelegate* _sessonDelegate; 39 remoting::RemotingClientSessonDelegate* _sessonDelegate;
39 ClientSessionDetails* _sessionDetails; 40 ClientSessionDetails* _sessionDetails;
40 // Call _secretFetchedCallback on the network thread. 41 // Call _secretFetchedCallback on the network thread.
41 remoting::protocol::SecretFetchedCallback _secretFetchedCallback; 42 remoting::protocol::SecretFetchedCallback _secretFetchedCallback;
42 std::unique_ptr<remoting::GestureInterpreter> _gestureInterpreter; 43 std::unique_ptr<remoting::GestureInterpreter> _gestureInterpreter;
43 // std::unique_ptr<remoting::KeyboardInterpreter> _keyboardInterpreter; 44 std::unique_ptr<remoting::KeyboardInterpreter> _keyboardInterpreter;
44 } 45 }
45 @end 46 @end
46 47
47 @implementation RemotingClient 48 @implementation RemotingClient
48 49
49 @synthesize displayHandler = _displayHandler; 50 @synthesize displayHandler = _displayHandler;
50 51
51 - (instancetype)init { 52 - (instancetype)init {
52 self = [super init]; 53 self = [super init];
53 if (self) { 54 if (self) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 [_displayHandler CreateVideoRenderer], audioPlayer, info, 122 [_displayHandler CreateVideoRenderer], audioPlayer, info,
122 client_auth_config)); 123 client_auth_config));
123 _session->Connect(); 124 _session->Connect();
124 125
125 __weak GlDisplayHandler* weakDisplayHandler = _displayHandler; 126 __weak GlDisplayHandler* weakDisplayHandler = _displayHandler;
126 _gestureInterpreter.reset(new remoting::GestureInterpreter( 127 _gestureInterpreter.reset(new remoting::GestureInterpreter(
127 base::BindBlockArc(^(const remoting::ViewMatrix& matrix) { 128 base::BindBlockArc(^(const remoting::ViewMatrix& matrix) {
128 [weakDisplayHandler onPixelTransformationChanged:matrix]; 129 [weakDisplayHandler onPixelTransformationChanged:matrix];
129 }), 130 }),
130 _session.get())); 131 _session.get()));
132
133 _keyboardInterpreter.reset(new remoting::KeyboardInterpreter(_session.get()));
131 } 134 }
132 135
133 - (void)disconnectFromHost { 136 - (void)disconnectFromHost {
134 if (_session) { 137 if (_session) {
135 _session->Disconnect(); 138 _session->Disconnect();
136 } 139 }
137 // TODO(nicholss): Do we need to cleanup more? 140 // TODO(nicholss): Do we need to cleanup more?
138 } 141 }
139 142
140 #pragma mark - Eventing 143 #pragma mark - Eventing
(...skipping 11 matching lines...) Expand all
152 #pragma mark - Properties 155 #pragma mark - Properties
153 156
154 - (HostInfo*)hostInfo { 157 - (HostInfo*)hostInfo {
155 return _sessionDetails.hostInfo; 158 return _sessionDetails.hostInfo;
156 } 159 }
157 160
158 - (remoting::GestureInterpreter*)gestureInterpreter { 161 - (remoting::GestureInterpreter*)gestureInterpreter {
159 return _gestureInterpreter.get(); 162 return _gestureInterpreter.get();
160 } 163 }
161 164
165 - (remoting::KeyboardInterpreter*)keyboardInterpreter {
166 return _keyboardInterpreter.get();
167 }
168
162 #pragma mark - ChromotingSession::Delegate 169 #pragma mark - ChromotingSession::Delegate
163 170
164 - (void)onConnectionState:(remoting::protocol::ConnectionToHost::State)state 171 - (void)onConnectionState:(remoting::protocol::ConnectionToHost::State)state
165 error:(remoting::protocol::ErrorCode)error { 172 error:(remoting::protocol::ErrorCode)error {
166 switch (state) { 173 switch (state) {
167 case remoting::protocol::ConnectionToHost::INITIALIZING: 174 case remoting::protocol::ConnectionToHost::INITIALIZING:
168 NSLog(@"State --> INITIALIZING"); 175 NSLog(@"State --> INITIALIZING");
169 _sessionDetails.state = SessionInitializing; 176 _sessionDetails.state = SessionInitializing;
170 break; 177 break;
171 case remoting::protocol::ConnectionToHost::CONNECTING: 178 case remoting::protocol::ConnectionToHost::CONNECTING:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 237
231 #pragma mark - GlDisplayHandlerDelegate 238 #pragma mark - GlDisplayHandlerDelegate
232 239
233 - (void)canvasSizeChanged:(CGSize)size { 240 - (void)canvasSizeChanged:(CGSize)size {
234 if (_gestureInterpreter) { 241 if (_gestureInterpreter) {
235 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); 242 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height);
236 } 243 }
237 } 244 }
238 245
239 @end 246 @end
OLDNEW
« remoting/client/native_device_keymap.cc ('K') | « remoting/ios/session/remoting_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698