summaryrefslogtreecommitdiffstats
path: root/chrome/views/table_view.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-08 15:44:52 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-08 15:44:52 +0000
commitc117dffdb52bb572ac6f5f61e364b62d502129f2 (patch)
tree40008fd901a8423ece4f02393d3a8e5d9d7124ab /chrome/views/table_view.cc
parente6f45624a5e05fcce4171080c56d5a671bd28e97 (diff)
downloadchromium_src-c117dffdb52bb572ac6f5f61e364b62d502129f2.zip
chromium_src-c117dffdb52bb572ac6f5f61e364b62d502129f2.tar.gz
chromium_src-c117dffdb52bb572ac6f5f61e364b62d502129f2.tar.bz2
Enables sorting of the tables in the password editor and the URL
picker dialog. BUG=2949 TEST=Try sorting in the password manager dialog table as well as when adding a URL to the list of URLs to open on startup. Review URL: http://codereview.chromium.org/6053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3010 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/table_view.cc')
-rw-r--r--chrome/views/table_view.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc
index e50cf04..c3100f8 100644
--- a/chrome/views/table_view.cc
+++ b/chrome/views/table_view.cc
@@ -19,8 +19,6 @@
#include "chrome/views/view_container.h"
#include "SkBitmap.h"
#include "SkColorFilter.h"
-#include "unicode/coll.h"
-#include "unicode/uchar.h"
namespace ChromeViews {
@@ -45,16 +43,8 @@ int TableModel::CompareValues(int row1, int row2, int column_id) {
row2 >= 0 && row2 < RowCount());
std::wstring value1 = GetText(row1, column_id);
std::wstring value2 = GetText(row2, column_id);
+ Collator* collator = GetCollator();
- if (!collator) {
- UErrorCode create_status = U_ZERO_ERROR;
- collator = Collator::createInstance(create_status);
- if (!U_SUCCESS(create_status)) {
- collator = NULL;
- NOTREACHED();
- }
- }
-
if (collator) {
UErrorCode compare_status = U_ZERO_ERROR;
UCollationResult compare_result = collator->compare(
@@ -70,6 +60,18 @@ int TableModel::CompareValues(int row1, int row2, int column_id) {
return 0;
}
+Collator* TableModel::GetCollator() {
+ if (!collator) {
+ UErrorCode create_status = U_ZERO_ERROR;
+ collator = Collator::createInstance(create_status);
+ if (!U_SUCCESS(create_status)) {
+ collator = NULL;
+ NOTREACHED();
+ }
+ }
+ return collator;
+}
+
// TableView ------------------------------------------------------------------
TableView::TableView(TableModel* model,