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/autofill/autofill_dialog.h" | 5 #include "chrome/browser/autofill/autofill_dialog.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return table; | 131 return table; |
132 } | 132 } |
133 | 133 |
134 // Sets the label of the form widget at |row|,|col|. The label is |len| columns | 134 // Sets the label of the form widget at |row|,|col|. The label is |len| columns |
135 // long. | 135 // long. |
136 void FormTableSetLabel( | 136 void FormTableSetLabel( |
137 GtkWidget* table, int row, int col, int len, int label_id) { | 137 GtkWidget* table, int row, int col, int len, int label_id) { |
138 // We have two table rows per form table row. | 138 // We have two table rows per form table row. |
139 row *= 2; | 139 row *= 2; |
140 | 140 |
141 const char* text = | 141 std::string text; |
142 (label_id) ? l10n_util::GetStringUTF8(label_id).c_str() : 0; | 142 if (label_id) |
143 GtkWidget* label = gtk_label_new(text); | 143 text = l10n_util::GetStringUTF8(label_id); |
| 144 GtkWidget* label = gtk_label_new(text.c_str()); |
144 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | 145 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
145 gtk_table_attach(GTK_TABLE(table), label, | 146 gtk_table_attach(GTK_TABLE(table), label, |
146 col, col + len, // Left col, right col. | 147 col, col + len, // Left col, right col. |
147 row, row + 1, // Top row, bottom row. | 148 row, row + 1, // Top row, bottom row. |
148 GTK_FILL, GTK_FILL, // Options. | 149 GTK_FILL, GTK_FILL, // Options. |
149 0, 0); // Padding. | 150 0, 0); // Padding. |
150 } | 151 } |
151 | 152 |
152 // Sets the form widget at |row|,|col|. The widget fills up |len| columns. If | 153 // Sets the form widget at |row|,|col|. The widget fills up |len| columns. If |
153 // |expand| is true, the widget will expand to fill all of the extra space in | 154 // |expand| is true, the widget will expand to fill all of the extra space in |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 // Factory/finder method: | 900 // Factory/finder method: |
900 | 901 |
901 void ShowAutoFillDialog(AutoFillDialogObserver* observer, | 902 void ShowAutoFillDialog(AutoFillDialogObserver* observer, |
902 const std::vector<AutoFillProfile*>& profiles, | 903 const std::vector<AutoFillProfile*>& profiles, |
903 const std::vector<CreditCard*>& credit_cards) { | 904 const std::vector<CreditCard*>& credit_cards) { |
904 if (!dialog) { | 905 if (!dialog) { |
905 dialog = new AutoFillDialog(observer, profiles, credit_cards); | 906 dialog = new AutoFillDialog(observer, profiles, credit_cards); |
906 } | 907 } |
907 dialog->Show(); | 908 dialog->Show(); |
908 } | 909 } |
OLD | NEW |