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

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

Issue 2862893003: [CRD iOS] Inject mouse events to the host (Closed)
Patch Set: Fix 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/client/ios/session/remoting_client.h" 9 #import "remoting/client/ios/session/remoting_client.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 selector:@selector(hostSessionPinProvided:) 59 selector:@selector(hostSessionPinProvided:)
60 name:kHostSessionPinProvided 60 name:kHostSessionPinProvided
61 object:nil]; 61 object:nil];
62 } 62 }
63 return self; 63 return self;
64 } 64 }
65 65
66 - (void)connectToHost:(HostInfo*)hostInfo 66 - (void)connectToHost:(HostInfo*)hostInfo
67 username:(NSString*)username 67 username:(NSString*)username
68 accessToken:(NSString*)accessToken { 68 accessToken:(NSString*)accessToken {
69 DCHECK(_runtime->ui_task_runner()->BelongsToCurrentThread());
69 DCHECK(hostInfo); 70 DCHECK(hostInfo);
70 DCHECK(hostInfo.jabberId); 71 DCHECK(hostInfo.jabberId);
71 DCHECK(hostInfo.hostId); 72 DCHECK(hostInfo.hostId);
72 DCHECK(hostInfo.publicKey); 73 DCHECK(hostInfo.publicKey);
73 74
74 _sessionDetails.hostInfo = hostInfo; 75 _sessionDetails.hostInfo = hostInfo;
75 76
76 remoting::ConnectToHostInfo info; 77 remoting::ConnectToHostInfo info;
77 info.username = base::SysNSStringToUTF8(username); 78 info.username = base::SysNSStringToUTF8(username);
78 info.auth_token = base::SysNSStringToUTF8(accessToken); 79 info.auth_token = base::SysNSStringToUTF8(accessToken);
(...skipping 27 matching lines...) Expand all
106 userInfo:[NSDictionary 107 userInfo:[NSDictionary
107 dictionaryWithObject:_sessionDetails 108 dictionaryWithObject:_sessionDetails
108 forKey:kSessionDetails]]; 109 forKey:kSessionDetails]];
109 }); 110 });
110 111
111 // TODO(nicholss): Add audio support to iOS. 112 // TODO(nicholss): Add audio support to iOS.
112 base::WeakPtr<remoting::protocol::AudioStub> audioPlayer = nullptr; 113 base::WeakPtr<remoting::protocol::AudioStub> audioPlayer = nullptr;
113 114
114 _displayHandler = [[GlDisplayHandler alloc] init]; 115 _displayHandler = [[GlDisplayHandler alloc] init];
115 _displayHandler.delegate = self; 116 _displayHandler.delegate = self;
117
118 _session.reset(new remoting::ChromotingSession(
Yuwei 2017/05/05 05:28:02 It looks like connectToHost is called on the UI th
nicholss 2017/05/08 15:34:18 I think it is fine unless ->Connect is blocking
Yuwei 2017/05/08 20:45:26 ChromotingSession will just post a task to connect
119 _sessonDelegate->GetWeakPtr(), [_displayHandler CreateCursorShapeStub],
120 [_displayHandler CreateVideoRenderer], audioPlayer, info,
121 client_auth_config));
122 _session->Connect();
123
116 __weak GlDisplayHandler* weakDisplayHandler = _displayHandler; 124 __weak GlDisplayHandler* weakDisplayHandler = _displayHandler;
117 _gestureInterpreter.reset(new remoting::GestureInterpreter( 125 _gestureInterpreter.reset(new remoting::GestureInterpreter(
118 base::BindBlockArc(^(const remoting::ViewMatrix& matrix) { 126 base::BindBlockArc(^(const remoting::ViewMatrix& matrix) {
119 [weakDisplayHandler onPixelTransformationChanged:matrix]; 127 [weakDisplayHandler onPixelTransformationChanged:matrix];
120 }))); 128 }),
121 129 _session.get()));
122 _runtime->ui_task_runner()->PostTask(
123 FROM_HERE, base::BindBlockArc(^{
124 _session.reset(new remoting::ChromotingSession(
125 _sessonDelegate->GetWeakPtr(),
126 [_displayHandler CreateCursorShapeStub],
127 [_displayHandler CreateVideoRenderer], audioPlayer, info,
128 client_auth_config));
129 _session->Connect();
130 }));
131 } 130 }
132 131
133 #pragma mark - Eventing 132 #pragma mark - Eventing
134 133
135 - (void)hostSessionPinProvided:(NSNotification*)notification { 134 - (void)hostSessionPinProvided:(NSNotification*)notification {
136 NSString* pin = [[notification userInfo] objectForKey:kHostSessionPin]; 135 NSString* pin = [[notification userInfo] objectForKey:kHostSessionPin];
137 if (_secretFetchedCallback) { 136 if (_secretFetchedCallback) {
138 _runtime->network_task_runner()->PostTask( 137 _runtime->network_task_runner()->PostTask(
139 FROM_HERE, base::BindBlockArc(^{ 138 FROM_HERE, base::BindBlockArc(^{
140 _secretFetchedCallback.Run(base::SysNSStringToUTF8(pin)); 139 _secretFetchedCallback.Run(base::SysNSStringToUTF8(pin));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 222
224 #pragma mark - GlDisplayHandlerDelegate 223 #pragma mark - GlDisplayHandlerDelegate
225 224
226 - (void)canvasSizeChanged:(CGSize)size { 225 - (void)canvasSizeChanged:(CGSize)size {
227 if (_gestureInterpreter) { 226 if (_gestureInterpreter) {
228 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height); 227 _gestureInterpreter->OnDesktopSizeChanged(size.width, size.height);
229 } 228 }
230 } 229 }
231 230
232 @end 231 @end
OLDNEW
« remoting/client/desktop_viewport.h ('K') | « remoting/client/ios/client_gestures.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698