OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 5 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
6 | 6 |
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
8 #include <locale.h> | 8 #include <locale.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 | 611 |
612 int GetCurrentCountryID() { | 612 int GetCurrentCountryID() { |
613 GEOID geo_id = GetUserGeoID(GEOCLASS_NATION); | 613 GEOID geo_id = GetUserGeoID(GEOCLASS_NATION); |
614 | 614 |
615 return GeoIDToCountryID(geo_id); | 615 return GeoIDToCountryID(geo_id); |
616 } | 616 } |
617 | 617 |
618 #elif defined(OS_MACOSX) | 618 #elif defined(OS_MACOSX) |
619 | 619 |
620 int GetCurrentCountryID() { | 620 int GetCurrentCountryID() { |
621 base::mac::ScopedCFTypeRef<CFLocaleRef> locale(CFLocaleCopyCurrent()); | 621 base::ScopedCFTypeRef<CFLocaleRef> locale(CFLocaleCopyCurrent()); |
622 CFStringRef country = (CFStringRef)CFLocaleGetValue(locale.get(), | 622 CFStringRef country = |
Mark Mentovai
2013/06/21 20:29:40
The only reason I can see that this was touched is
Nico
2013/06/21 21:09:06
Huh, this is strange. Looking…
I think this is a
| |
623 kCFLocaleCountryCode); | 623 (CFStringRef)CFLocaleGetValue(locale.get(), kCFLocaleCountryCode); |
624 if (!country) | 624 if (!country) |
625 return kCountryIDUnknown; | 625 return kCountryIDUnknown; |
626 | 626 |
627 UniChar isobuf[2]; | 627 UniChar isobuf[2]; |
628 CFRange char_range = CFRangeMake(0, 2); | 628 CFRange char_range = CFRangeMake(0, 2); |
629 CFStringGetCharacters(country, char_range, isobuf); | 629 CFStringGetCharacters(country, char_range, isobuf); |
630 | 630 |
631 return CountryCharsToCountryIDWithUpdate(static_cast<char>(isobuf[0]), | 631 return CountryCharsToCountryIDWithUpdate(static_cast<char>(isobuf[0]), |
632 static_cast<char>(isobuf[1])); | 632 static_cast<char>(isobuf[1])); |
633 } | 633 } |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { | 1301 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { |
1302 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { | 1302 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { |
1303 return GURL((size == LOGO_200_PERCENT) ? | 1303 return GURL((size == LOGO_200_PERCENT) ? |
1304 google_logos.logo_200_percent_url : | 1304 google_logos.logo_200_percent_url : |
1305 google_logos.logo_100_percent_url); | 1305 google_logos.logo_100_percent_url); |
1306 } | 1306 } |
1307 return GURL(); | 1307 return GURL(); |
1308 } | 1308 } |
1309 | 1309 |
1310 } // namespace TemplateURLPrepopulateData | 1310 } // namespace TemplateURLPrepopulateData |
OLD | NEW |