Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / autofill / core / common / autofill_l10n_util.cc
blob6f063a85f4f7821d0e962b3d26680b26d075d151
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
3 // found in the LICENSE file.
5 #include "components/autofill/core/common/autofill_l10n_util.h"
7 #include "base/i18n/string_compare.h"
8 #include "base/logging.h"
10 namespace autofill {
11 namespace l10n {
13 CaseInsensitiveCompare::CaseInsensitiveCompare() {
14 UErrorCode error = U_ZERO_ERROR;
15 collator_.reset(icu::Collator::createInstance(error));
16 DCHECK(U_SUCCESS(error));
17 collator_->setStrength(icu::Collator::PRIMARY);
20 CaseInsensitiveCompare::~CaseInsensitiveCompare() {
23 bool CaseInsensitiveCompare::StringsEqual(const base::string16& lhs,
24 const base::string16& rhs) const {
25 return base::i18n::CompareString16WithCollator(*collator_, lhs, rhs) ==
26 UCOL_EQUAL;
29 } // namespace l10n
30 } // namespace autofill