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