summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/l10n/l10n_util.cc19
-rw-r--r--ui/base/l10n/l10n_util_collator.h12
-rw-r--r--ui/base/models/table_model.cc4
3 files changed, 8 insertions, 27 deletions
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
index 0b7b9b7..03abc81 100644
--- a/ui/base/l10n/l10n_util.cc
+++ b/ui/base/l10n/l10n_util.cc
@@ -14,6 +14,7 @@
#include "base/file_util.h"
#include "base/i18n/file_util_icu.h"
#include "base/i18n/rtl.h"
+#include "base/i18n/string_compare.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/string_number_conversions.h"
@@ -777,21 +778,6 @@ string16 GetStringFUTF16Int(int message_id, int64 a) {
return GetStringFUTF16(message_id, UTF8ToUTF16(base::Int64ToString(a)));
}
-// Compares the character data stored in two different string16 strings by
-// specified Collator instance.
-UCollationResult CompareString16WithCollator(const icu::Collator* collator,
- const string16& lhs,
- const string16& rhs) {
- DCHECK(collator);
- UErrorCode error = U_ZERO_ERROR;
- UCollationResult result = collator->compare(
- static_cast<const UChar*>(lhs.c_str()), static_cast<int>(lhs.length()),
- static_cast<const UChar*>(rhs.c_str()), static_cast<int>(rhs.length()),
- error);
- DCHECK(U_SUCCESS(error));
- return result;
-}
-
// Specialization of operator() method for string16 version.
template <>
bool StringComparator<string16>::operator()(const string16& lhs,
@@ -800,7 +786,8 @@ bool StringComparator<string16>::operator()(const string16& lhs,
// string compare.
if (!collator_)
return lhs < rhs;
- return CompareString16WithCollator(collator_, lhs, rhs) == UCOL_LESS;
+ return base::i18n::CompareString16WithCollator(collator_, lhs, rhs) ==
+ UCOL_LESS;
};
void SortStrings16(const std::string& locale,
diff --git a/ui/base/l10n/l10n_util_collator.h b/ui/base/l10n/l10n_util_collator.h
index fb43692..44e4a77 100644
--- a/ui/base/l10n/l10n_util_collator.h
+++ b/ui/base/l10n/l10n_util_collator.h
@@ -10,19 +10,13 @@
#include <string>
#include <vector>
+#include "base/i18n/string_compare.h"
#include "base/memory/scoped_ptr.h"
-#include "base/utf_string_conversions.h"
#include "third_party/icu/public/i18n/unicode/coll.h"
#include "ui/base/ui_export.h"
namespace l10n_util {
-// Compares the two strings using the specified collator.
-UI_EXPORT UCollationResult CompareString16WithCollator(
- const icu::Collator* collator,
- const string16& lhs,
- const string16& rhs);
-
// Used by SortStringsUsingMethod. Invokes a method on the objects passed to
// operator (), comparing the string results using a collator.
template <class T, class Method>
@@ -37,8 +31,8 @@ class StringMethodComparatorWithCollator
// Returns true if lhs preceeds rhs.
bool operator() (T* lhs_t, T* rhs_t) {
- return CompareString16WithCollator(collator_, (lhs_t->*method_)(),
- (rhs_t->*method_)()) == UCOL_LESS;
+ return base::i18n::CompareString16WithCollator(collator_,
+ (lhs_t->*method_)(), (rhs_t->*method_)()) == UCOL_LESS;
}
private:
diff --git a/ui/base/models/table_model.cc b/ui/base/models/table_model.cc
index f59e7dd..47520f0 100644
--- a/ui/base/models/table_model.cc
+++ b/ui/base/models/table_model.cc
@@ -4,9 +4,9 @@
#include "ui/base/models/table_model.h"
+#include "base/i18n/string_compare.h"
#include "base/logging.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/l10n/l10n_util_collator.h"
#include "ui/gfx/image/image_skia.h"
namespace ui {
@@ -76,7 +76,7 @@ int TableModel::CompareValues(int row1, int row2, int column_id) {
icu::Collator* collator = GetCollator();
if (collator)
- return l10n_util::CompareString16WithCollator(collator, value1, value2);
+ return base::i18n::CompareString16WithCollator(collator, value1, value2);
NOTREACHED();
return 0;