Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: remoting/client/ios/host_preferences.mm

Issue 2871993003: Moving the iOS directory to be remoting top level. (Closed)
Patch Set: //remoting/ios was the old landing target for the internal iOS application. Fix. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/ios/host_preferences.h ('k') | remoting/client/ios/host_preferences_persistence.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/ios/host_preferences.mm
diff --git a/remoting/client/ios/host_preferences.mm b/remoting/client/ios/host_preferences.mm
deleted file mode 100644
index 59ba32272ef418a241b6e4b3de939458b42421f6..0000000000000000000000000000000000000000
--- a/remoting/client/ios/host_preferences.mm
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
-#import "remoting/client/ios/host_preferences.h"
-
-#import "base/logging.h"
-#import "remoting/client/ios/host_preferences_persistence.h"
-
-namespace {
-static NSString* const kHostPreferencesDataKeyHostDictionary =
- @"kHostPreferencesDataKeyHostDictionary";
-static NSString* const kHostPreferencesHostIdKey = @"HostId";
-static NSString* const kHostPreferencesPairIdKey = @"PairId";
-static NSString* const kHostPreferencesPairSecretKey = @"PairSecret";
-} // namespace
-
-@interface HostPreferences ()
-
-// Load the known hosts from the Keychain.
-// If no data exists, return an empty dictionary
-+ (NSMutableDictionary*)loadHosts;
-
-@end
-
-@implementation HostPreferences
-
-@synthesize hostId = _hostId;
-@synthesize pairId = _pairId;
-@synthesize pairSecret = _pairSecret;
-
-#pragma mark - Public
-
-- (void)saveToKeychain {
- NSMutableDictionary* hosts = [HostPreferences loadHosts];
- [hosts setObject:self forKey:_hostId];
-
- NSData* writeData = [NSKeyedArchiver archivedDataWithRootObject:hosts];
-
- NSError* keychainError =
- remoting::ios::WriteHostPreferencesToKeychain(writeData);
-
- LOG_IF(ERROR, !keychainError) << "Could not write to keychain.";
-}
-
-+ (HostPreferences*)hostForId:(NSString*)hostId {
- NSMutableDictionary* hosts = [HostPreferences loadHosts];
- HostPreferences* host = hosts[hostId];
- if (!host) {
- host = [[HostPreferences alloc] init];
- host.hostId = hostId;
- host.pairId = @"";
- host.pairSecret = @"";
- }
- return host;
-}
-
-#pragma mark - Private
-
-+ (NSMutableDictionary*)loadHosts {
- NSData* readData = remoting::ios::ReadHostPreferencesFromKeychain();
- if (readData) {
- return [NSKeyedUnarchiver unarchiveObjectWithData:readData];
- } else {
- return [[NSMutableDictionary alloc] init];
- }
-}
-
-#pragma mark - NSCoding
-
-- (instancetype)initWithCoder:(NSCoder*)coder {
- self = [super init];
- if (self) {
- [self setHostId:[coder decodeObjectForKey:kHostPreferencesHostIdKey]];
- [self setPairId:[coder decodeObjectForKey:kHostPreferencesPairIdKey]];
- [self
- setPairSecret:[coder decodeObjectForKey:kHostPreferencesPairSecretKey]];
- }
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder*)coder {
- [coder encodeObject:_hostId forKey:kHostPreferencesHostIdKey];
- [coder encodeObject:_pairId forKey:kHostPreferencesPairIdKey];
- [coder encodeObject:_pairSecret forKey:kHostPreferencesPairSecretKey];
-}
-
-@end
« no previous file with comments | « remoting/client/ios/host_preferences.h ('k') | remoting/client/ios/host_preferences_persistence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698