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

Side by Side Diff: Source/platform/text/LocaleMac.mm

Issue 139243002: StringImpl should not be referred from StringImplCF. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 LocaleMac::LocaleMac(NSLocale* locale) 83 LocaleMac::LocaleMac(NSLocale* locale)
84 : m_locale(locale) 84 : m_locale(locale)
85 , m_gregorianCalendar(AdoptNS, [[NSCalendar alloc] initWithCalendarIdentifie r:NSGregorianCalendar]) 85 , m_gregorianCalendar(AdoptNS, [[NSCalendar alloc] initWithCalendarIdentifie r:NSGregorianCalendar])
86 , m_didInitializeNumberData(false) 86 , m_didInitializeNumberData(false)
87 { 87 {
88 NSArray* availableLanguages = [NSLocale ISOLanguageCodes]; 88 NSArray* availableLanguages = [NSLocale ISOLanguageCodes];
89 // NSLocale returns a lower case NSLocaleLanguageCode so we don't have care about case. 89 // NSLocale returns a lower case NSLocaleLanguageCode so we don't have care about case.
90 NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode]; 90 NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode];
91 if ([availableLanguages indexOfObject:language] == NSNotFound) 91 if ([availableLanguages indexOfObject:language] == NSNotFound) {
92 m_locale.adoptNS([[NSLocale alloc] initWithLocaleIdentifier:defaultLangu age()]); 92 NSString *nsLanguage = [[NSString alloc] initWithUTF8String:defaultLangu age().utf8().data()];
Nico 2014/01/15 19:06:12 This too leaks
tasak 2014/01/17 08:17:29 Done.
93 m_locale.adoptNS([[NSLocale alloc] initWithLocaleIdentifier:nsLanguage]) ;
94 }
93 [m_gregorianCalendar.get() setLocale:m_locale.get()]; 95 [m_gregorianCalendar.get() setLocale:m_locale.get()];
94 } 96 }
95 97
96 LocaleMac::~LocaleMac() 98 LocaleMac::~LocaleMac()
97 { 99 {
98 } 100 }
99 101
100 PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier) 102 PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier)
101 { 103 {
102 RetainPtr<NSLocale> locale = [[NSLocale alloc] initWithLocaleIdentifier:loca leIdentifier]; 104 RetainPtr<NSLocale> locale = [[NSLocale alloc] initWithLocaleIdentifier:loca leIdentifier];
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 ASSERT(symbols.size() == DecimalSymbolsSize); 322 ASSERT(symbols.size() == DecimalSymbolsSize);
321 323
322 String positivePrefix([formatter.get() positivePrefix]); 324 String positivePrefix([formatter.get() positivePrefix]);
323 String positiveSuffix([formatter.get() positiveSuffix]); 325 String positiveSuffix([formatter.get() positiveSuffix]);
324 String negativePrefix([formatter.get() negativePrefix]); 326 String negativePrefix([formatter.get() negativePrefix]);
325 String negativeSuffix([formatter.get() negativeSuffix]); 327 String negativeSuffix([formatter.get() negativeSuffix]);
326 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negat iveSuffix); 328 setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negat iveSuffix);
327 } 329 }
328 330
329 } 331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698