Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1200)

Unified Diff: app/table_model.cc

Issue 126184: Move TableModel out of views/ and into app/.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: addressed comments, build fixes Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/table_model.h ('k') | app/table_model_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/table_model.cc
===================================================================
--- app/table_model.cc (revision 18411)
+++ app/table_model.cc (working copy)
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "views/controls/table/table_model.h"
+#include "app/table_model.h"
#include "app/l10n_util.h"
+#include "third_party/skia/include/core/SkBitmap.h"
-namespace views {
+// TableColumn -----------------------------------------------------------------
TableColumn::TableColumn()
: id(0),
@@ -64,5 +65,42 @@
title = l10n_util::GetString(id);
}
-} // namespace views
+// TableModel -----------------------------------------------------------------
+// Used for sorting.
+static Collator* collator = NULL;
+
+SkBitmap TableModel::GetIcon(int row) {
+ return SkBitmap();
+}
+
+int TableModel::CompareValues(int row1, int row2, int column_id) {
+ DCHECK(row1 >= 0 && row1 < RowCount() &&
+ row2 >= 0 && row2 < RowCount());
+ std::wstring value1 = GetText(row1, column_id);
+ std::wstring value2 = GetText(row2, column_id);
+ Collator* collator = GetCollator();
+
+ if (collator)
+ return l10n_util::CompareStringWithCollator(collator, value1, value2);
+
+ NOTREACHED();
+ 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;
+}
+
+void TableModel::ClearCollator() {
+ delete collator;
+ collator = NULL;
+}
« no previous file with comments | « app/table_model.h ('k') | app/table_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698