OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
6 #error "This file requires ARC support." | |
7 #endif | |
8 | |
9 #import "remoting/client/ios/session/client.h" | |
10 | |
11 #import "base/mac/bind_objc_block.h" | |
12 | |
13 #include "remoting/client/chromoting_client_runtime.h" | |
14 #include "remoting/client/connect_to_host_info.h" | |
15 | |
16 @interface RemotingClient () { | |
17 GlDisplayHandler* _displayHandler; | |
18 remoting::ChromotingClientRuntime* _runtime; | |
19 std::unique_ptr<remoting::ChromotingSession> _session; | |
20 remoting::RemotingClientSessonDelegate* _sessonDelegate; | |
21 } | |
22 @end | |
23 | |
24 @implementation RemotingClient | |
25 | |
26 - (instancetype)init { | |
27 self = [super init]; | |
28 if (self) { | |
29 _runtime = ChromotingClientRuntime::GetInstance(); | |
30 _sessonDelegate = new remoting::RemotingClientSessonDelegate(self); | |
31 } | |
32 return self; | |
33 } | |
34 | |
35 - (void)connectToHost:(const remoting::ConnectToHostInfo&)info { | |
36 _displayHandler = [[GlDisplayHandler alloc] initWithRuntime:_runtime]; | |
37 | |
38 protocol::ClientAuthenticationConfig client_auth_config; | |
39 client_auth_config.host_id = info.host_id; | |
40 client_auth_config.pairing_client_id = info.pairing_id; | |
41 client_auth_config.pairing_secret = info.pairing_secret; | |
42 client_auth_config.fetch_secret_callback = base::BindBlockArc( | |
43 ^(bool pairing_supported, | |
44 const SecretFetchedCallback& secret_fetched_callback) { | |
45 NSLog(@"TODO(nicholss): Implement the FetchSecretCallback."); | |
Yuwei
2017/04/08 02:42:37
Just curious why do you log out the TODO rather th
nicholss
2017/04/10 16:17:09
I wanted the TODO in the logs while I am working o
| |
46 }); | |
47 | |
48 // TODO(nicholss): Add audio support to iOS. | |
49 base::WeakPtr<protocol::AudioStub> audioPlayer = nullptr; | |
50 | |
51 _session.reset(new remoting::ChromotingSession( | |
52 _sessonDelegate->GetWeakPtr(), [_displayHandler CreateCursorShapeStub], | |
53 [_displayHandler CreateVideoRenderer], audioPlayer, info, | |
54 client_auth_config)); | |
55 _session->Connect(); | |
56 } | |
57 | |
58 #pragma mark - ChromotingSession::Delegate | |
59 | |
60 - (void)onConnectionState:(protocol::ConnectionToHost::State)state | |
61 error:(protocol::ErrorCode)error { | |
62 NSLog(@"TODO(nicholss): implement this."); | |
63 } | |
64 | |
65 - (void)commitPairingCredentialsForHost:(NSString*)host | |
66 id:(NSString*)id | |
67 secret:(NSString*)secret { | |
68 NSLog(@"TODO(nicholss): implement this."); | |
69 } | |
70 | |
71 - (void)fetchThirdPartyTokenForUrl:(NSString*)tokenUrl | |
72 clientId:(NSString*)clientId | |
73 scope:(NSString*)scope { | |
74 NSLog(@"TODO(nicholss): implement this."); | |
75 } | |
76 | |
77 - (void)setCapabilities:(NSString*)capabilities { | |
78 NSLog(@"TODO(nicholss): implement this."); | |
79 } | |
80 | |
81 - (void)handleExtensionMessageOfType:(NSString*)type | |
82 message:(NSString*)message { | |
83 NSLog(@"TODO(nicholss): implement this."); | |
84 } | |
85 | |
86 @end | |
OLD | NEW |