| 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..661bce5ebfc9b581d4a473f18abdc0f9008d5d05 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 {
|
|
|
| @@ -18,10 +21,7 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages";
|
|
|
| #pragma mark - SpeechInputLocaleMatchConfig
|
|
|
| -@interface SpeechInputLocaleMatchConfig () {
|
| - // Backing object for the property of the same name.
|
| - base::scoped_nsobject<NSArray> _matches;
|
| -}
|
| +@interface SpeechInputLocaleMatchConfig ()
|
|
|
| // Loads |_matches| from config file |plistFileName|.
|
| - (void)loadConfigFile:(NSString*)plistFileName;
|
| @@ -29,6 +29,7 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages";
|
| @end
|
|
|
| @implementation SpeechInputLocaleMatchConfig
|
| +@synthesize matches = _matches;
|
|
|
| + (instancetype)sharedInstance {
|
| static SpeechInputLocaleMatchConfig* matchConfig;
|
| @@ -47,11 +48,6 @@ NSString* const kMatchingLanguagesKey = @"MatchingLanguages";
|
| return self;
|
| }
|
|
|
| -#pragma mark Accessors
|
| -
|
| -- (NSArray*)matches {
|
| - return _matches.get();
|
| -}
|
|
|
| #pragma mark - Private
|
|
|
| @@ -63,49 +59,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
|
|
|