OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/views/generic_info_view.h" | 5 #include "chrome/browser/views/generic_info_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/utf_string_conversions.h" |
8 #include "gfx/color_utils.h" | 10 #include "gfx/color_utils.h" |
9 #include "base/logging.h" | |
10 #include "views/grid_layout.h" | 11 #include "views/grid_layout.h" |
11 #include "views/controls/label.h" | 12 #include "views/controls/label.h" |
12 #include "views/controls/textfield/textfield.h" | 13 #include "views/controls/textfield/textfield.h" |
13 #include "views/standard_layout.h" | 14 #include "views/standard_layout.h" |
14 | 15 |
15 GenericInfoView::GenericInfoView(int number_of_rows) | 16 GenericInfoView::GenericInfoView(int number_of_rows) |
16 : number_of_rows_(number_of_rows), name_string_ids_(NULL) { | 17 : number_of_rows_(number_of_rows), name_string_ids_(NULL) { |
17 DCHECK(number_of_rows_ > 0); | 18 DCHECK(number_of_rows_ > 0); |
18 } | 19 } |
19 | 20 |
20 GenericInfoView::GenericInfoView( | 21 GenericInfoView::GenericInfoView( |
21 int number_of_rows, const int name_string_ids[]) | 22 int number_of_rows, const int name_string_ids[]) |
22 : number_of_rows_(number_of_rows), name_string_ids_(name_string_ids) { | 23 : number_of_rows_(number_of_rows), name_string_ids_(name_string_ids) { |
23 DCHECK(number_of_rows_ > 0); | 24 DCHECK(number_of_rows_ > 0); |
24 } | 25 } |
25 | 26 |
26 void GenericInfoView::SetNameByStringId(int row, int name_string_id) { | 27 void GenericInfoView::SetNameByStringId(int row, int name_string_id) { |
27 SetName(row, l10n_util::GetString(name_string_id)); | 28 SetName(row, UTF16ToWide(l10n_util::GetStringUTF16(name_string_id))); |
28 } | 29 } |
29 | 30 |
30 void GenericInfoView::SetName(int row, const string16& name) { | 31 void GenericInfoView::SetName(int row, const string16& name) { |
31 DCHECK(name_views_.get()); // Can only be called after Init time. | 32 DCHECK(name_views_.get()); // Can only be called after Init time. |
32 DCHECK(row >= 0 && row < number_of_rows_); | 33 DCHECK(row >= 0 && row < number_of_rows_); |
33 name_views_[row]->SetText(name); | 34 name_views_[row]->SetText(name); |
34 } | 35 } |
35 | 36 |
36 void GenericInfoView::SetValue(int row, const string16& name) { | 37 void GenericInfoView::SetValue(int row, const string16& name) { |
37 DCHECK(value_views_.get()); // Can only be called after Init time. | 38 DCHECK(value_views_.get()); // Can only be called after Init time. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 layout->AddView(value); | 97 layout->AddView(value); |
97 | 98 |
98 // Color these borderless text areas the same as the containing dialog. | 99 // Color these borderless text areas the same as the containing dialog. |
99 SkColor text_area_background = color_utils::GetSysSkColor(COLOR_3DFACE); | 100 SkColor text_area_background = color_utils::GetSysSkColor(COLOR_3DFACE); |
100 | 101 |
101 // Init them now that they're in the view hierarchy. | 102 // Init them now that they're in the view hierarchy. |
102 value->SetReadOnly(true); | 103 value->SetReadOnly(true); |
103 value->RemoveBorder(); | 104 value->RemoveBorder(); |
104 value->SetBackgroundColor(text_area_background); | 105 value->SetBackgroundColor(text_area_background); |
105 } | 106 } |
OLD | NEW |