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/ios/facade/remoting_service.h" | 9 #import "remoting/ios/facade/remoting_service.h" |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 switch (host_status) { | 90 switch (host_status) { |
| 91 case remoting::kHostStatusOnline: | 91 case remoting::kHostStatusOnline: |
| 92 status = "ONLINE"; | 92 status = "ONLINE"; |
| 93 break; | 93 break; |
| 94 case remoting::kHostStatusOffline: | 94 case remoting::kHostStatusOffline: |
| 95 status = "OFFLINE"; | 95 status = "OFFLINE"; |
| 96 break; | 96 break; |
| 97 default: | 97 default: |
| 98 NOTREACHED(); | 98 NOTREACHED(); |
| 99 } | 99 } |
| 100 // TODO(nicholss): Not yet integrated: createdTime, hostVersion, | 100 // TODO(nicholss): Not yet integrated: createdTime, kind, |
| 101 // kind, offlineReason. Add them as the app will need this info. | 101 // offlineReason. Add them as the app will need this info. |
| 102 HostInfo* host = [[HostInfo alloc] init]; | 102 HostInfo* host = [[HostInfo alloc] init]; |
| 103 host.hostId = | 103 host.hostId = |
| 104 [NSString stringWithCString:host_info.host_id.c_str() | 104 [NSString stringWithCString:host_info.host_id.c_str() |
| 105 encoding:[NSString defaultCStringEncoding]]; | 105 encoding:[NSString defaultCStringEncoding]]; |
| 106 host.hostName = | 106 host.hostName = |
| 107 [NSString stringWithCString:host_info.host_name.c_str() | 107 [NSString stringWithCString:host_info.host_name.c_str() |
| 108 encoding:[NSString defaultCStringEncoding]]; | 108 encoding:[NSString defaultCStringEncoding]]; |
| 109 host.hostOs = | |
| 110 [NSString stringWithCString:host_info.host_os.c_str() | |
|
nicholss
2017/05/25 21:51:47
I did not know at the time, but there is a base ch
Yuwei
2017/05/25 22:24:24
Done. This is quite nice :)
| |
| 111 encoding:[NSString defaultCStringEncoding]]; | |
| 112 host.hostOsVersion = | |
| 113 [NSString stringWithCString:host_info.host_os_version.c_str() | |
| 114 encoding:[NSString defaultCStringEncoding]]; | |
| 115 host.hostVersion = | |
| 116 [NSString stringWithCString:host_info.host_version.c_str() | |
| 117 encoding:[NSString defaultCStringEncoding]]; | |
| 109 host.jabberId = | 118 host.jabberId = |
| 110 [NSString stringWithCString:host_info.host_jid.c_str() | 119 [NSString stringWithCString:host_info.host_jid.c_str() |
| 111 encoding:[NSString defaultCStringEncoding]]; | 120 encoding:[NSString defaultCStringEncoding]]; |
| 112 host.publicKey = | 121 host.publicKey = |
| 113 [NSString stringWithCString:host_info.public_key.c_str() | 122 [NSString stringWithCString:host_info.public_key.c_str() |
| 114 encoding:[NSString defaultCStringEncoding]]; | 123 encoding:[NSString defaultCStringEncoding]]; |
| 115 host.status = | 124 host.status = |
| 116 [NSString stringWithCString:status.c_str() | 125 [NSString stringWithCString:status.c_str() |
| 117 encoding:[NSString defaultCStringEncoding]]; | 126 encoding:[NSString defaultCStringEncoding]]; |
| 118 [hosts addObject:host]; | 127 [hosts addObject:host]; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 const std::string& user_email, | 176 const std::string& user_email, |
| 168 const std::string& access_token) { | 177 const std::string& access_token) { |
| 169 NSString* accessToken = | 178 NSString* accessToken = |
| 170 [NSString stringWithCString:access_token.c_str() | 179 [NSString stringWithCString:access_token.c_str() |
| 171 encoding:[NSString defaultCStringEncoding]]; | 180 encoding:[NSString defaultCStringEncoding]]; |
| 172 [self startHostListFetchWith:accessToken]; | 181 [self startHostListFetchWith:accessToken]; |
| 173 })]; | 182 })]; |
| 174 } | 183 } |
| 175 | 184 |
| 176 @end | 185 @end |
| OLD | NEW |