| 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 |
| 11 #import <Foundation/Foundation.h> | 11 #import <Foundation/Foundation.h> |
| 12 #import <Security/Security.h> | 12 #import <Security/Security.h> |
| 13 | 13 |
| 14 #import "base/mac/bind_objc_block.h" | 14 #import "base/mac/bind_objc_block.h" |
| 15 #import "remoting/ios/domain/host_info.h" | 15 #import "remoting/ios/domain/host_info.h" |
| 16 #import "remoting/ios/domain/user_info.h" | 16 #import "remoting/ios/domain/user_info.h" |
| 17 #import "remoting/ios/facade/host_info.h" | 17 #import "remoting/ios/facade/host_info.h" |
| 18 #import "remoting/ios/facade/host_list_fetcher.h" | 18 #import "remoting/ios/facade/host_list_fetcher.h" |
| 19 #import "remoting/ios/facade/ios_client_runtime_delegate.h" | 19 #import "remoting/ios/facade/ios_client_runtime_delegate.h" |
| 20 #import "remoting/ios/facade/remoting_authentication.h" | 20 #import "remoting/ios/facade/remoting_authentication.h" |
| 21 #import "remoting/ios/facade/remoting_service.h" | 21 #import "remoting/ios/facade/remoting_service.h" |
| 22 #import "remoting/ios/keychain_wrapper.h" | 22 #import "remoting/ios/keychain_wrapper.h" |
| 23 | 23 |
| 24 #include "base/i18n/time_formatting.h" |
| 24 #include "base/logging.h" | 25 #include "base/logging.h" |
| 25 #include "base/strings/sys_string_conversions.h" | 26 #include "base/strings/sys_string_conversions.h" |
| 26 #include "net/url_request/url_request_context_getter.h" | 27 #include "net/url_request/url_request_context_getter.h" |
| 27 #include "remoting/base/oauth_token_getter.h" | 28 #include "remoting/base/oauth_token_getter.h" |
| 28 #include "remoting/base/oauth_token_getter_impl.h" | 29 #include "remoting/base/oauth_token_getter_impl.h" |
| 29 | 30 |
| 30 static NSString* const kCRDAuthenticatedUserEmailKey = | 31 static NSString* const kCRDAuthenticatedUserEmailKey = |
| 31 @"kCRDAuthenticatedUserEmailKey"; | 32 @"kCRDAuthenticatedUserEmailKey"; |
| 32 | 33 |
| 33 NSString* const kHostsDidUpdate = @"kHostsDidUpdate"; | 34 NSString* const kHostsDidUpdate = @"kHostsDidUpdate"; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 HostInfo* host = [[HostInfo alloc] init]; | 103 HostInfo* host = [[HostInfo alloc] init]; |
| 103 host.hostId = base::SysUTF8ToNSString(host_info.host_id); | 104 host.hostId = base::SysUTF8ToNSString(host_info.host_id); |
| 104 host.hostName = base::SysUTF8ToNSString(host_info.host_name); | 105 host.hostName = base::SysUTF8ToNSString(host_info.host_name); |
| 105 host.hostOs = base::SysUTF8ToNSString(host_info.host_os); | 106 host.hostOs = base::SysUTF8ToNSString(host_info.host_os); |
| 106 host.hostOsVersion = | 107 host.hostOsVersion = |
| 107 base::SysUTF8ToNSString(host_info.host_os_version); | 108 base::SysUTF8ToNSString(host_info.host_os_version); |
| 108 host.hostVersion = base::SysUTF8ToNSString(host_info.host_version); | 109 host.hostVersion = base::SysUTF8ToNSString(host_info.host_version); |
| 109 host.jabberId = base::SysUTF8ToNSString(host_info.host_jid); | 110 host.jabberId = base::SysUTF8ToNSString(host_info.host_jid); |
| 110 host.publicKey = base::SysUTF8ToNSString(host_info.public_key); | 111 host.publicKey = base::SysUTF8ToNSString(host_info.public_key); |
| 111 host.status = base::SysUTF8ToNSString(status); | 112 host.status = base::SysUTF8ToNSString(status); |
| 113 host.updatedTime = base::SysUTF16ToNSString( |
| 114 base::TimeFormatShortDateAndTime(host_info.updated_time)); |
| 112 [hosts addObject:host]; | 115 [hosts addObject:host]; |
| 113 } | 116 } |
| 114 _hosts = hosts; | 117 _hosts = hosts; |
| 115 [self hostListUpdated]; | 118 [self hostListUpdated]; |
| 116 })); | 119 })); |
| 117 } | 120 } |
| 118 | 121 |
| 119 #pragma mark - Notifications | 122 #pragma mark - Notifications |
| 120 | 123 |
| 121 - (void)hostListUpdated { | 124 - (void)hostListUpdated { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 callbackWithAccessToken:base::BindBlockArc(^( | 162 callbackWithAccessToken:base::BindBlockArc(^( |
| 160 remoting::OAuthTokenGetter::Status status, | 163 remoting::OAuthTokenGetter::Status status, |
| 161 const std::string& user_email, | 164 const std::string& user_email, |
| 162 const std::string& access_token) { | 165 const std::string& access_token) { |
| 163 NSString* accessToken = base::SysUTF8ToNSString(access_token); | 166 NSString* accessToken = base::SysUTF8ToNSString(access_token); |
| 164 [self startHostListFetchWith:accessToken]; | 167 [self startHostListFetchWith:accessToken]; |
| 165 })]; | 168 })]; |
| 166 } | 169 } |
| 167 | 170 |
| 168 @end | 171 @end |
| OLD | NEW |