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/client/ios/host_preferences.h" | 9 #import "remoting/client/ios/host_preferences.h" |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 - (void)saveToKeychain { | 38 - (void)saveToKeychain { |
| 39 NSMutableDictionary* hosts = [HostPreferences loadHosts]; | 39 NSMutableDictionary* hosts = [HostPreferences loadHosts]; |
| 40 [hosts setObject:self forKey:_hostId]; | 40 [hosts setObject:self forKey:_hostId]; |
| 41 | 41 |
| 42 NSData* writeData = [NSKeyedArchiver archivedDataWithRootObject:hosts]; | 42 NSData* writeData = [NSKeyedArchiver archivedDataWithRootObject:hosts]; |
| 43 | 43 |
| 44 NSError* keychainError = | 44 NSError* keychainError = |
| 45 remoting::ios::WriteHostPreferencesToKeychain(writeData); | 45 remoting::ios::WriteHostPreferencesToKeychain(writeData); |
| 46 | 46 |
| 47 DLOG_IF(ERROR, !keychainError) << "Could not write to keychain."; | 47 if (!keychainError) { |
|
sdefresne
2017/04/12 15:27:52
This is https://codereview.chromium.org/2817513004
nicholss
2017/04/12 15:35:32
I am working on removing this file from this cl :)
| |
| 48 LOG(ERROR) << "Could not write to keychain."; | |
| 49 } | |
| 48 } | 50 } |
| 49 | 51 |
| 50 + (HostPreferences*)hostForId:(NSString*)hostId { | 52 + (HostPreferences*)hostForId:(NSString*)hostId { |
| 51 NSMutableDictionary* hosts = [HostPreferences loadHosts]; | 53 NSMutableDictionary* hosts = [HostPreferences loadHosts]; |
| 52 HostPreferences* host = hosts[hostId]; | 54 HostPreferences* host = hosts[hostId]; |
| 53 if (!host) { | 55 if (!host) { |
| 54 host = [[HostPreferences alloc] init]; | 56 host = [[HostPreferences alloc] init]; |
| 55 host.hostId = hostId; | 57 host.hostId = hostId; |
| 56 host.pairId = @""; | 58 host.pairId = @""; |
| 57 host.pairSecret = @""; | 59 host.pairSecret = @""; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 83 return self; | 85 return self; |
| 84 } | 86 } |
| 85 | 87 |
| 86 - (void)encodeWithCoder:(NSCoder*)coder { | 88 - (void)encodeWithCoder:(NSCoder*)coder { |
| 87 [coder encodeObject:_hostId forKey:kHostPreferencesHostIdKey]; | 89 [coder encodeObject:_hostId forKey:kHostPreferencesHostIdKey]; |
| 88 [coder encodeObject:_pairId forKey:kHostPreferencesPairIdKey]; | 90 [coder encodeObject:_pairId forKey:kHostPreferencesPairIdKey]; |
| 89 [coder encodeObject:_pairSecret forKey:kHostPreferencesPairSecretKey]; | 91 [coder encodeObject:_pairSecret forKey:kHostPreferencesPairSecretKey]; |
| 90 } | 92 } |
| 91 | 93 |
| 92 @end | 94 @end |
| OLD | NEW |