OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "app/table_model.h" | 5 #include "app/table_model.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 | 9 |
10 // TableColumn ----------------------------------------------------------------- | 10 // TableColumn ----------------------------------------------------------------- |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 width(width), | 61 width(width), |
62 percent(percent), | 62 percent(percent), |
63 min_visible_width(0), | 63 min_visible_width(0), |
64 sortable(false) { | 64 sortable(false) { |
65 title = l10n_util::GetString(id); | 65 title = l10n_util::GetString(id); |
66 } | 66 } |
67 | 67 |
68 // TableModel ----------------------------------------------------------------- | 68 // TableModel ----------------------------------------------------------------- |
69 | 69 |
70 // Used for sorting. | 70 // Used for sorting. |
71 static Collator* collator = NULL; | 71 static icu::Collator* collator = NULL; |
72 | 72 |
73 SkBitmap TableModel::GetIcon(int row) { | 73 SkBitmap TableModel::GetIcon(int row) { |
74 return SkBitmap(); | 74 return SkBitmap(); |
75 } | 75 } |
76 | 76 |
77 int TableModel::CompareValues(int row1, int row2, int column_id) { | 77 int TableModel::CompareValues(int row1, int row2, int column_id) { |
78 DCHECK(row1 >= 0 && row1 < RowCount() && | 78 DCHECK(row1 >= 0 && row1 < RowCount() && |
79 row2 >= 0 && row2 < RowCount()); | 79 row2 >= 0 && row2 < RowCount()); |
80 std::wstring value1 = GetText(row1, column_id); | 80 std::wstring value1 = GetText(row1, column_id); |
81 std::wstring value2 = GetText(row2, column_id); | 81 std::wstring value2 = GetText(row2, column_id); |
82 Collator* collator = GetCollator(); | 82 icu::Collator* collator = GetCollator(); |
83 | 83 |
84 if (collator) | 84 if (collator) |
85 return l10n_util::CompareStringWithCollator(collator, value1, value2); | 85 return l10n_util::CompareStringWithCollator(collator, value1, value2); |
86 | 86 |
87 NOTREACHED(); | 87 NOTREACHED(); |
88 return 0; | 88 return 0; |
89 } | 89 } |
90 | 90 |
91 Collator* TableModel::GetCollator() { | 91 icu::Collator* TableModel::GetCollator() { |
92 if (!collator) { | 92 if (!collator) { |
93 UErrorCode create_status = U_ZERO_ERROR; | 93 UErrorCode create_status = U_ZERO_ERROR; |
94 collator = Collator::createInstance(create_status); | 94 collator = icu::Collator::createInstance(create_status); |
95 if (!U_SUCCESS(create_status)) { | 95 if (!U_SUCCESS(create_status)) { |
96 collator = NULL; | 96 collator = NULL; |
97 NOTREACHED(); | 97 NOTREACHED(); |
98 } | 98 } |
99 } | 99 } |
100 return collator; | 100 return collator; |
101 } | 101 } |
102 | 102 |
103 void TableModel::ClearCollator() { | 103 void TableModel::ClearCollator() { |
104 delete collator; | 104 delete collator; |
105 collator = NULL; | 105 collator = NULL; |
106 } | 106 } |
OLD | NEW |