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/app/client_connection_view_controller.h" | 9 #import "remoting/ios/app/client_connection_view_controller.h" |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 @implementation ClientConnectionViewController | 53 @implementation ClientConnectionViewController |
54 | 54 |
55 @synthesize state = _state; | 55 @synthesize state = _state; |
56 | 56 |
57 - (instancetype)initWithHostInfo:(HostInfo*)hostInfo { | 57 - (instancetype)initWithHostInfo:(HostInfo*)hostInfo { |
58 self = [super init]; | 58 self = [super init]; |
59 if (self) { | 59 if (self) { |
60 _client = [[RemotingClient alloc] init]; | 60 _client = [[RemotingClient alloc] init]; |
61 | 61 |
62 __weak RemotingClient* weakClient = _client; | 62 __weak RemotingClient* weakClient = _client; |
63 [[RemotingService SharedInstance].authentication | 63 [RemotingService.instance.authentication |
64 callbackWithAccessToken:base::BindBlockArc(^( | 64 callbackWithAccessToken:^(RemotingAuthenticationStatus status, |
65 remoting::OAuthTokenGetter::Status status, | 65 NSString* userEmail, NSString* accessToken) { |
66 const std::string& user_email, | |
67 const std::string& access_token) { | |
68 [weakClient connectToHost:hostInfo | 66 [weakClient connectToHost:hostInfo |
69 username:base::SysUTF8ToNSString(user_email) | 67 username:userEmail |
70 accessToken:base::SysUTF8ToNSString(access_token)]; | 68 accessToken:accessToken]; |
71 })]; | 69 }]; |
72 | 70 |
73 _remoteHostName = hostInfo.hostName; | 71 _remoteHostName = hostInfo.hostName; |
74 | 72 |
75 // TODO(yuweih): This logic may be reused by other views. | 73 // TODO(yuweih): This logic may be reused by other views. |
76 UIButton* cancelButton = [UIButton buttonWithType:UIButtonTypeSystem]; | 74 UIButton* cancelButton = [UIButton buttonWithType:UIButtonTypeSystem]; |
77 [cancelButton setTitle:@"CANCEL" forState:UIControlStateNormal]; | 75 [cancelButton setTitle:@"CANCEL" forState:UIControlStateNormal]; |
78 [cancelButton | 76 [cancelButton |
79 setImage:[RemotingTheme | 77 setImage:[RemotingTheme |
80 .backIcon imageFlippedForRightToLeftLayoutDirection] | 78 .backIcon imageFlippedForRightToLeftLayoutDirection] |
81 forState:UIControlStateNormal]; | 79 forState:UIControlStateNormal]; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 default: | 354 default: |
357 LOG(ERROR) << "Unknown State for Session, " << sessionDetails.state; | 355 LOG(ERROR) << "Unknown State for Session, " << sessionDetails.state; |
358 return; | 356 return; |
359 } | 357 } |
360 [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | 358 [[NSOperationQueue mainQueue] addOperationWithBlock:^{ |
361 [self setState:state]; | 359 [self setState:state]; |
362 }]; | 360 }]; |
363 } | 361 } |
364 | 362 |
365 @end | 363 @end |
OLD | NEW |