host_settings.mm 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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
  3. // found in the LICENSE file.
  4. #if !defined(__has_feature) || !__has_feature(objc_arc)
  5. #error "This file requires ARC support."
  6. #endif
  7. #import "remoting/ios/domain/host_settings.h"
  8. @implementation HostSettings
  9. @synthesize hostId = _hostId;
  10. @synthesize inputMode = _inputMode;
  11. @synthesize shouldResizeHostToFit = _shouldResizeHostToFit;
  12. - (id)initWithCoder:(NSCoder*)coder {
  13. self = [super init];
  14. if (self) {
  15. self.hostId = [coder decodeObjectForKey:@"hostId"];
  16. NSNumber* mode = [coder decodeObjectForKey:@"inputMode"];
  17. self.inputMode = (ClientInputMode)[mode intValue];
  18. self.shouldResizeHostToFit =
  19. [[coder decodeObjectForKey:@"shouldResizeHostToFit"] boolValue];
  20. }
  21. return self;
  22. }
  23. - (void)encodeWithCoder:(NSCoder*)coder {
  24. [coder encodeObject:self.hostId forKey:@"hostId"];
  25. NSNumber* mode = [NSNumber numberWithInt:self.inputMode];
  26. [coder encodeObject:mode forKey:@"inputMode"];
  27. [coder encodeObject:@(self.shouldResizeHostToFit)
  28. forKey:@"shouldResizeHostToFit"];
  29. }
  30. - (NSString*)description {
  31. return [NSString stringWithFormat:@"HostSettings: hostId=%@ inputMode=%d",
  32. _hostId, (int)_inputMode];
  33. }
  34. @end