OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/strings/string16.h" | 6 #include "base/strings/string16.h" |
7 #include "third_party/icu/source/common/unicode/locid.h" | 7 #include "third_party/icu/source/common/unicode/locid.h" |
8 #include "third_party/icu/source/i18n/unicode/coll.h" | 8 #include "third_party/icu/source/i18n/unicode/coll.h" |
9 | 9 |
10 namespace autofill { | 10 namespace autofill { |
11 namespace l10n { | 11 namespace l10n { |
12 | 12 |
13 // Obtains the ICU Collator for this locale. If unsuccessful, attempts to return | 13 // Obtains the ICU Collator for this locale. If unsuccessful, attempts to return |
14 // the ICU collator for the English locale. If unsuccessful, returns null. | 14 // the ICU collator for the English locale. If unsuccessful, returns null. |
15 icu::Collator* GetCollatorForLocale(const icu::Locale& locale); | 15 scoped_ptr<icu::Collator> GetCollatorForLocale(const icu::Locale& locale); |
16 | 16 |
17 // Assists with locale-aware case insensitive string comparisons. | 17 // Assists with locale-aware case insensitive string comparisons. |
18 class CaseInsensitiveCompare { | 18 class CaseInsensitiveCompare { |
19 public: | 19 public: |
20 CaseInsensitiveCompare(); | 20 CaseInsensitiveCompare(); |
21 // Used for testing. | 21 // Used for testing. |
22 explicit CaseInsensitiveCompare(const icu::Locale& locale); | 22 explicit CaseInsensitiveCompare(const icu::Locale& locale); |
23 ~CaseInsensitiveCompare(); | 23 ~CaseInsensitiveCompare(); |
24 | 24 |
25 bool StringsEqual(const base::string16& lhs, const base::string16& rhs) const; | 25 bool StringsEqual(const base::string16& lhs, const base::string16& rhs) const; |
26 | 26 |
27 private: | 27 private: |
28 scoped_ptr<icu::Collator> collator_; | 28 scoped_ptr<icu::Collator> collator_; |
29 | 29 |
30 DISALLOW_COPY_AND_ASSIGN(CaseInsensitiveCompare); | 30 DISALLOW_COPY_AND_ASSIGN(CaseInsensitiveCompare); |
31 }; | 31 }; |
32 | 32 |
33 } // namespace l10n | 33 } // namespace l10n |
34 } // namespace autofill | 34 } // namespace autofill |
OLD | NEW |