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 "app/gtk_signal.h" | 9 #include "app/gtk_signal.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/string_number_conversions.h" |
16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/autofill/personal_data_manager.h" | 18 #include "chrome/browser/autofill/personal_data_manager.h" |
18 #include "chrome/browser/autofill/phone_number.h" | 19 #include "chrome/browser/autofill/phone_number.h" |
19 #include "chrome/browser/gtk/gtk_util.h" | 20 #include "chrome/browser/gtk/gtk_util.h" |
20 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
21 #include "grit/app_resources.h" | 22 #include "grit/app_resources.h" |
22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
23 #include "grit/locale_settings.h" | 24 #include "grit/locale_settings.h" |
24 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
25 | 26 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 } | 881 } |
881 | 882 |
882 if (edited_number_) | 883 if (edited_number_) |
883 SetFormValue(number_, card, CREDIT_CARD_NUMBER); | 884 SetFormValue(number_, card, CREDIT_CARD_NUMBER); |
884 | 885 |
885 int selected_month_index = | 886 int selected_month_index = |
886 gtk_combo_box_get_active(GTK_COMBO_BOX(month_)); | 887 gtk_combo_box_get_active(GTK_COMBO_BOX(month_)); |
887 if (selected_month_index == -1) | 888 if (selected_month_index == -1) |
888 selected_month_index = 0; | 889 selected_month_index = 0; |
889 card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), | 890 card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), |
890 IntToString16(selected_month_index + 1)); | 891 base::IntToString16(selected_month_index + 1)); |
891 | 892 |
892 int selected_year_index = | 893 int selected_year_index = |
893 gtk_combo_box_get_active(GTK_COMBO_BOX(year_)); | 894 gtk_combo_box_get_active(GTK_COMBO_BOX(year_)); |
894 if (selected_year_index == -1) | 895 if (selected_year_index == -1) |
895 selected_year_index = 0; | 896 selected_year_index = 0; |
896 card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), | 897 card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), |
897 IntToString16(selected_year_index + base_year_)); | 898 base::IntToString16(selected_year_index + base_year_)); |
898 } | 899 } |
899 | 900 |
900 void AutoFillCreditCardEditor::UpdateOkButton() { | 901 void AutoFillCreditCardEditor::UpdateOkButton() { |
901 // Enable the ok button if at least one field is non-empty and the phone | 902 // Enable the ok button if at least one field is non-empty and the phone |
902 // numbers are valid. | 903 // numbers are valid. |
903 bool valid = !GetEntryText(name_).empty() || !GetEntryText(number_).empty(); | 904 bool valid = !GetEntryText(name_).empty() || !GetEntryText(number_).empty(); |
904 gtk_widget_set_sensitive(ok_button_, valid); | 905 gtk_widget_set_sensitive(ok_button_, valid); |
905 } | 906 } |
906 | 907 |
907 void AutoFillCreditCardEditor::OnDestroy(GtkWidget* widget) { | 908 void AutoFillCreditCardEditor::OnDestroy(GtkWidget* widget) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 new AutoFillProfileEditor(observer, profile, auto_fill_profile); | 965 new AutoFillProfileEditor(observer, profile, auto_fill_profile); |
965 } | 966 } |
966 | 967 |
967 void ShowAutoFillCreditCardEditor(gfx::NativeView parent, | 968 void ShowAutoFillCreditCardEditor(gfx::NativeView parent, |
968 AutoFillDialogObserver* observer, | 969 AutoFillDialogObserver* observer, |
969 Profile* profile, | 970 Profile* profile, |
970 CreditCard* credit_card) { | 971 CreditCard* credit_card) { |
971 // AutoFillCreditCardEditor takes care of deleting itself. | 972 // AutoFillCreditCardEditor takes care of deleting itself. |
972 new AutoFillCreditCardEditor(observer, profile, credit_card); | 973 new AutoFillCreditCardEditor(observer, profile, credit_card); |
973 } | 974 } |
OLD | NEW |