Chromium Code Reviews| Index: ios/chrome/browser/voice/speech_input_locale_match_config.mm |
| diff --git a/ios/chrome/browser/voice/speech_input_locale_match_config.mm b/ios/chrome/browser/voice/speech_input_locale_match_config.mm |
| index e53a8a0b94280865235432b1666aef53308aef93..137cf4cd29d83d928bc19ef98e874a6b28460955 100644 |
| --- a/ios/chrome/browser/voice/speech_input_locale_match_config.mm |
| +++ b/ios/chrome/browser/voice/speech_input_locale_match_config.mm |
| @@ -5,7 +5,10 @@ |
| #import "ios/chrome/browser/voice/speech_input_locale_match_config.h" |
| #import "base/mac/foundation_util.h" |
| -#import "base/mac/scoped_nsobject.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| namespace { |
| @@ -19,8 +22,6 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages"; |
| #pragma mark - SpeechInputLocaleMatchConfig |
| @interface SpeechInputLocaleMatchConfig () { |
| - // Backing object for the property of the same name. |
| - base::scoped_nsobject<NSArray> _matches; |
| } |
|
kkhorimoto
2017/06/01 19:25:27
Can you also remove the curly braces themselves?
lindsayw
2017/06/02 13:31:51
Done.
|
| // Loads |_matches| from config file |plistFileName|. |
| @@ -29,6 +30,7 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages"; |
| @end |
| @implementation SpeechInputLocaleMatchConfig |
| +@synthesize matches = _matches; |
| + (instancetype)sharedInstance { |
| static SpeechInputLocaleMatchConfig* matchConfig; |
| @@ -47,11 +49,6 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages"; |
| return self; |
| } |
| -#pragma mark Accessors |
| - |
| -- (NSArray*)matches { |
| - return _matches.get(); |
| -} |
| #pragma mark - Private |
| @@ -63,49 +60,29 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages"; |
| NSMutableArray* matches = [NSMutableArray array]; |
| for (id item in configData) { |
| NSDictionary* matchDict = base::mac::ObjCCastStrict<NSDictionary>(item); |
| - base::scoped_nsobject<SpeechInputLocaleMatch> match( |
| - [[SpeechInputLocaleMatch alloc] initWithDictionary:matchDict]); |
| + SpeechInputLocaleMatch* match = |
| + [[SpeechInputLocaleMatch alloc] initWithDictionary:matchDict]; |
| [matches addObject:match]; |
| } |
| - _matches.reset([matches copy]); |
| + _matches = [matches copy]; |
| } |
| @end |
| #pragma mark - SpeechInputLocaleMatch |
| -@interface SpeechInputLocaleMatch () { |
| - // Backing objects for properties of the same name. |
| - base::scoped_nsobject<NSString> _matchedLocaleCode; |
| - base::scoped_nsobject<NSArray> _matchingLocaleCodes; |
| - base::scoped_nsobject<NSArray> _matchingLanguages; |
| -} |
| - |
| -@end |
| - |
| @implementation SpeechInputLocaleMatch |
| +@synthesize matchedLocaleCode = _matchedLocaleCode; |
| +@synthesize matchingLocaleCodes = _matchingLocaleCodes; |
| +@synthesize matchingLanguages = _matchingLanguages; |
| - (instancetype)initWithDictionary:(NSDictionary*)matchDict { |
| if ((self = [super init])) { |
| - _matchedLocaleCode.reset([matchDict[kMatchedLocaleKey] copy]); |
| - _matchingLocaleCodes.reset([matchDict[kMatchingLocalesKey] copy]); |
| - _matchingLanguages.reset([matchDict[kMatchingLanguagesKey] copy]); |
| + _matchedLocaleCode = [matchDict[kMatchedLocaleKey] copy]; |
| + _matchingLocaleCodes = [matchDict[kMatchingLocalesKey] copy]; |
| + _matchingLanguages = [matchDict[kMatchingLanguagesKey] copy]; |
| } |
| return self; |
| } |
| -#pragma mark Accessors |
| - |
| -- (NSString*)matchedLocaleCode { |
| - return _matchedLocaleCode; |
| -} |
| - |
| -- (NSArray*)matchingLocaleCodes { |
| - return _matchingLocaleCodes; |
| -} |
| - |
| -- (NSArray*)matchingLanguages { |
| - return _matchingLanguages; |
| -} |
| - |
| @end |