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

Side by Side Diff: chrome/browser/autofill/autofill_country.cc

Issue 6626070: Fix the settings page for es-419 locale: Spanish (Latin America). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_country_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autofill/autofill_country.h" 5 #include "chrome/browser/autofill/autofill_country.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 UErrorCode error_ignored = U_ZERO_ERROR; 380 UErrorCode error_ignored = U_ZERO_ERROR;
381 uloc_addLikelySubtags(locale.c_str(), 381 uloc_addLikelySubtags(locale.c_str(),
382 WriteInto(&likely_locale, kLocaleCapacity), 382 WriteInto(&likely_locale, kLocaleCapacity),
383 kLocaleCapacity, 383 kLocaleCapacity,
384 &error_ignored); 384 &error_ignored);
385 385
386 // Extract the country code. 386 // Extract the country code.
387 std::string country_code = icu::Locale(likely_locale.c_str()).getCountry(); 387 std::string country_code = icu::Locale(likely_locale.c_str()).getCountry();
388 388
389 // Default to the United States if we have no better guess. 389 // Default to the United States if we have no better guess.
390 return !country_code.empty() ? country_code : "US"; 390 if (!AutofillCountries::countries().count(country_code))
391 return "US";
392 return country_code;
391 } 393 }
392 394
393 // static 395 // static
394 const std::string AutofillCountry::GetCountryCode( 396 const std::string AutofillCountry::GetCountryCode(
395 const string16& country, const std::string& locale) { 397 const string16& country, const std::string& locale) {
396 // First, check for a few common synonyms. 398 // First, check for a few common synonyms.
397 if (country == ASCIIToUTF16("United States of America")) 399 if (country == ASCIIToUTF16("United States of America"))
398 return "US"; 400 return "US";
399 if (country == ASCIIToUTF16("Great Britain") || 401 if (country == ASCIIToUTF16("Great Britain") ||
400 country == ASCIIToUTF16("UK")) 402 country == ASCIIToUTF16("UK"))
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 455
454 AutofillCountry::AutofillCountry(const std::string& country_code, 456 AutofillCountry::AutofillCountry(const std::string& country_code,
455 const string16& name, 457 const string16& name,
456 const string16& postal_code_label, 458 const string16& postal_code_label,
457 const string16& state_label) 459 const string16& state_label)
458 : country_code_(country_code), 460 : country_code_(country_code),
459 name_(name), 461 name_(name),
460 postal_code_label_(postal_code_label), 462 postal_code_label_(postal_code_label),
461 state_label_(state_label) { 463 state_label_(state_label) {
462 } 464 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_country_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698