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

Side by Side Diff: third_party/libaddressinput/chromium/canonicalize_string.cc

Issue 275913002: Use the root locale instead of the system default locale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cpp/src/util/canonicalize_string.h" 5 #include "cpp/src/util/canonicalize_string.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cpp/include/libaddressinput/util/scoped_ptr.h" 8 #include "cpp/include/libaddressinput/util/scoped_ptr.h"
9 #include "third_party/icu/source/common/unicode/errorcode.h"
10 #include "third_party/icu/source/common/unicode/locid.h"
11 #include "third_party/icu/source/common/unicode/unistr.h"
12 #include "third_party/icu/source/common/unicode/utypes.h"
9 #include "third_party/icu/source/i18n/unicode/coll.h" 13 #include "third_party/icu/source/i18n/unicode/coll.h"
10 14
11 namespace i18n { 15 namespace i18n {
12 namespace addressinput { 16 namespace addressinput {
13 17
14 namespace { 18 namespace {
15 19
16 class ChromeStringCanonicalizer : public StringCanonicalizer { 20 class ChromeStringCanonicalizer : public StringCanonicalizer {
17 public: 21 public:
18 ChromeStringCanonicalizer() 22 ChromeStringCanonicalizer()
19 : error_code_(U_ZERO_ERROR), 23 : error_code_(U_ZERO_ERROR),
20 collator_(icu::Collator::createInstance(error_code_)) { 24 collator_(
25 icu::Collator::createInstance(
26 icu::Locale::getRoot(), error_code_)) {
21 collator_->setStrength(icu::Collator::PRIMARY); 27 collator_->setStrength(icu::Collator::PRIMARY);
22 DCHECK(U_SUCCESS(error_code_)); 28 DCHECK(U_SUCCESS(error_code_));
23 } 29 }
24 30
25 virtual ~ChromeStringCanonicalizer() {} 31 virtual ~ChromeStringCanonicalizer() {}
26 32
27 // StringCanonicalizer implementation. 33 // StringCanonicalizer implementation.
28 virtual std::string CanonicalizeString(const std::string& original) { 34 virtual std::string CanonicalizeString(const std::string& original) {
29 // Returns a canonical version of the string that can be used for comparing 35 // Returns a canonical version of the string that can be used for comparing
30 // strings regardless of diacritics and capitalization. 36 // strings regardless of diacritics and capitalization.
(...skipping 23 matching lines...) Expand all
54 60
55 } // namespace 61 } // namespace
56 62
57 // static 63 // static
58 scoped_ptr<StringCanonicalizer> StringCanonicalizer::Build() { 64 scoped_ptr<StringCanonicalizer> StringCanonicalizer::Build() {
59 return scoped_ptr<StringCanonicalizer>(new ChromeStringCanonicalizer); 65 return scoped_ptr<StringCanonicalizer>(new ChromeStringCanonicalizer);
60 } 66 }
61 67
62 } // namespace addressinput 68 } // namespace addressinput
63 } // namespace i18n 69 } // namespace i18n
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698