diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 20:39:28 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 20:39:28 +0000 |
commit | 70567e8e8a2a7f7642a1429584b77fc76b6d4cf2 (patch) | |
tree | 81ae0fd03a53796456b392e6fa174e525329c47e | |
parent | 3df6e3a85be5fc9f340da650111b51dde10d18f2 (diff) | |
download | chromium_src-70567e8e8a2a7f7642a1429584b77fc76b6d4cf2.zip chromium_src-70567e8e8a2a7f7642a1429584b77fc76b6d4cf2.tar.gz chromium_src-70567e8e8a2a7f7642a1429584b77fc76b6d4cf2.tar.bz2 |
Notify the AutoFillManager when the user clicks "Apply" or "OK". Adds an AutoFillDialogObserver interface that is used to send the profile information back to clients.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/555023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36779 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autofill/autofill_dialog.cc | 14 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_dialog.h | 22 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_dialog_gtk.cc | 196 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 13 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.h | 13 | ||||
-rw-r--r-- | chrome/browser/autofill/credit_card.cc | 22 | ||||
-rw-r--r-- | chrome/browser/autofill/credit_card.h | 3 | ||||
-rwxr-xr-x | chrome/chrome_browser.gypi | 1 |
8 files changed, 233 insertions, 51 deletions
diff --git a/chrome/browser/autofill/autofill_dialog.cc b/chrome/browser/autofill/autofill_dialog.cc new file mode 100644 index 0000000..d15cca4 --- /dev/null +++ b/chrome/browser/autofill/autofill_dialog.cc @@ -0,0 +1,14 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/autofill/autofill_dialog.h" + +// TODO(georgey, dhollowa): Remove these as each platform implements this +// function. The last one to implement the function should remove this file. +#if defined(OS_WIN) || defined(OS_MACOSX) +void ShowAutoFillDialog(AutoFillDialogObserver* observer, + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards) { +} +#endif // defined(OS_WIN) || defined(OS_MACOSX) diff --git a/chrome/browser/autofill/autofill_dialog.h b/chrome/browser/autofill/autofill_dialog.h index f1a5f5f..34006b4 100644 --- a/chrome/browser/autofill/autofill_dialog.h +++ b/chrome/browser/autofill/autofill_dialog.h @@ -8,13 +8,29 @@ #include <vector> #include "chrome/browser/autofill/autofill_profile.h" +#include "chrome/browser/autofill/credit_card.h" + +// An interface the AutoFill dialog uses to notify its clients (observers) when +// the user has applied changes to the AutoFill profile data. +class AutoFillDialogObserver { + public: + // The user has confirmed changes by clicking "Apply" or "OK". + virtual void OnAutoFillDialogApply( + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards) = 0; + + protected: + virtual ~AutoFillDialogObserver() {} +}; // Shows the AutoFill dialog, which allows the user to edit profile information. // |profiles| is a vector of autofill profiles that contains the current profile // information. The dialog fills out the profile fields using this data. Any // changes made to the profile information through the dialog should be -// transferred back into |profiles| and |credit_cards|. -void ShowAutoFillDialog(std::vector<AutoFillProfile>* profiles, - std::vector<FormGroup>* credit_cards); +// transferred back into |profiles| and |credit_cards|. |observer| will be +// notified by OnAutoFillDialogAccept when the user has applied changes. +void ShowAutoFillDialog(AutoFillDialogObserver* observer, + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards); #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_H_ diff --git a/chrome/browser/autofill/autofill_dialog_gtk.cc b/chrome/browser/autofill/autofill_dialog_gtk.cc index 3bf38f6..6432f59 100644 --- a/chrome/browser/autofill/autofill_dialog_gtk.cc +++ b/chrome/browser/autofill/autofill_dialog_gtk.cc @@ -10,8 +10,10 @@ #include "app/gfx/gtk_util.h" #include "app/l10n_util.h" +#include "base/logging.h" #include "base/message_loop.h" #include "chrome/browser/autofill/autofill_profile.h" +#include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/autofill/form_group.h" #include "chrome/browser/gtk/options/options_layout_gtk.h" #include "chrome/common/gtk_util.h" @@ -27,6 +29,30 @@ const char kDialogGroupTitleMarkup[] = "<span weight='bold'>%s</span>"; // How far we indent dialog widgets, in pixels. const int kAutoFillDialogIndent = 5; +// All of these widgets are GtkEntrys except for default_profile, which is a +// GtkCheckButton. +typedef struct _AddressWidgets { + GtkWidget* label; + GtkWidget* default_profile; + GtkWidget* first_name; + GtkWidget* middle_name; + GtkWidget* last_name; + GtkWidget* email; + GtkWidget* company_name; + GtkWidget* address_line1; + GtkWidget* address_line2; + GtkWidget* city; + GtkWidget* state; + GtkWidget* zipcode; + GtkWidget* country; + GtkWidget* phone1; + GtkWidget* phone2; + GtkWidget* phone3; + GtkWidget* fax1; + GtkWidget* fax2; + GtkWidget* fax3; +} AddressWidgets; + // Adds an alignment around |widget| which indents the widget by |offset|. GtkWidget* IndentWidget(GtkWidget* widget, int offset) { GtkWidget* alignment = gtk_alignment_new(0, 0, 0, 0); @@ -132,10 +158,11 @@ GtkWidget* FormTableAddExpandedEntry( // Adds a sized entry box to the form table. The entry widget width is set to // |char_len|. -void FormTableAddSizedEntry( +GtkWidget* FormTableAddSizedEntry( GtkWidget* table, int row, int col, int char_len, int label_id) { GtkWidget* entry = FormTableAddEntry(table, row, col, 1, label_id); gtk_entry_set_width_chars(GTK_ENTRY(entry), char_len); + return entry; } // Like FormTableAddEntry, but connects to the 'changed' signal. |changed| is a @@ -163,8 +190,9 @@ GtkWidget* FormTableAddLabelEntry( // and remove AutoFill profiles. class AutoFillDialog { public: - AutoFillDialog(std::vector<AutoFillProfile>* profiles, - std::vector<FormGroup>* credit_cards); + AutoFillDialog(AutoFillDialogObserver* observer, + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards); ~AutoFillDialog() {} // Shows the AutoFill dialog. @@ -175,6 +203,13 @@ class AutoFillDialog { // from here. static void OnDestroy(GtkWidget* widget, AutoFillDialog* autofill_dialog); + // 'response' signal handler. We notify the AutoFillDialogObserver that new + // data is available if the response is GTK_RESPONSE_APPLY or GTK_RESPONSE_OK. + // We close the dialog if the response is GTK_RESPONSE_OK or + // GTK_RESPONSE_CANCEL. + static void OnResponse(GtkDialog* dialog, gint response_id, + AutoFillDialog* autofill_dialog); + // 'clicked' signal handler. We add a new address. static void OnAddAddressClicked(GtkButton* button, AutoFillDialog* dialog); @@ -205,11 +240,14 @@ class AutoFillDialog { GtkWidget* AddNewAddress(); GtkWidget* AddNewCreditCard(); - // The list of current AutoFill profiles. Owned by AutoFillManager. - std::vector<AutoFillProfile>* profiles_; + // The list of current AutoFill profiles. + std::vector<AutoFillProfile> profiles_; - // The list of current AutoFill credit cards. Owned by AutoFillManager. - std::vector<FormGroup>* credit_cards_; + // The list of current AutoFill credit cards. + std::vector<CreditCard> credit_cards_; + + // The list of address widgets, used to modify the AutoFill profiles. + std::vector<AddressWidgets> address_widgets_; // The AutoFill dialog. GtkWidget* dialog_; @@ -220,16 +258,23 @@ class AutoFillDialog { // The credit cards group. GtkWidget* creditcards_vbox_; + // Our observer. + AutoFillDialogObserver* observer_; + DISALLOW_COPY_AND_ASSIGN(AutoFillDialog); }; // The singleton AutoFill dialog object. static AutoFillDialog* dialog = NULL; -AutoFillDialog::AutoFillDialog(std::vector<AutoFillProfile>* profiles, - std::vector<FormGroup>* credit_cards) +AutoFillDialog::AutoFillDialog(AutoFillDialogObserver* observer, + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards) : profiles_(profiles), - credit_cards_(credit_cards) { + credit_cards_(credit_cards), + observer_(observer) { + DCHECK(observer); + dialog_ = gtk_dialog_new_with_buttons( l10n_util::GetStringUTF8(IDS_AUTOFILL_DIALOG_TITLE).c_str(), // AutoFill dialog is shared between all browser windows. @@ -254,7 +299,7 @@ AutoFillDialog::AutoFillDialog(std::vector<AutoFillProfile>* profiles, gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL); gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), gtk_util::kContentAreaSpacing); - g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL); + g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this); g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroy), this); // Allow the contents to be scrolled. @@ -307,6 +352,73 @@ void AutoFillDialog::OnDestroy(GtkWidget* widget, MessageLoop::current()->DeleteSoon(FROM_HERE, autofill_dialog); } +static string16 GetEntryText(GtkWidget* entry) { + return UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(entry))); +} + +static AutoFillProfile AutoFillProfileFromWidgetValues( + const AddressWidgets& widgets) { + // TODO(jhawkins): unique id? + AutoFillProfile profile(GetEntryText(widgets.label), 0); + profile.SetInfo(AutoFillType(NAME_FIRST), + GetEntryText(widgets.first_name)); + profile.SetInfo(AutoFillType(NAME_MIDDLE), + GetEntryText(widgets.middle_name)); + profile.SetInfo(AutoFillType(NAME_LAST), + GetEntryText(widgets.last_name)); + profile.SetInfo(AutoFillType(EMAIL_ADDRESS), + GetEntryText(widgets.email)); + profile.SetInfo(AutoFillType(COMPANY_NAME), + GetEntryText(widgets.company_name)); + profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + GetEntryText(widgets.address_line1)); + profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + GetEntryText(widgets.address_line2)); + profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), + GetEntryText(widgets.city)); + profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), + GetEntryText(widgets.state)); + profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), + GetEntryText(widgets.zipcode)); + profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), + GetEntryText(widgets.country)); + profile.SetInfo(AutoFillType(PHONE_HOME_COUNTRY_CODE), + GetEntryText(widgets.phone1)); + profile.SetInfo(AutoFillType(PHONE_HOME_CITY_CODE), + GetEntryText(widgets.phone2)); + profile.SetInfo(AutoFillType(PHONE_HOME_NUMBER), + GetEntryText(widgets.phone3)); + profile.SetInfo(AutoFillType(PHONE_FAX_COUNTRY_CODE), + GetEntryText(widgets.fax1)); + profile.SetInfo(AutoFillType(PHONE_FAX_CITY_CODE), + GetEntryText(widgets.fax2)); + profile.SetInfo(AutoFillType(PHONE_FAX_NUMBER), + GetEntryText(widgets.fax3)); + return profile; +} + +// static +void AutoFillDialog::OnResponse(GtkDialog* dialog, gint response_id, + AutoFillDialog* autofill_dialog) { + if (response_id == GTK_RESPONSE_APPLY || response_id == GTK_RESPONSE_OK) { + autofill_dialog->profiles_.clear(); + std::vector<AddressWidgets>::const_iterator iter; + for (iter = autofill_dialog->address_widgets_.begin(); + iter != autofill_dialog->address_widgets_.end(); + ++iter) { + autofill_dialog->profiles_.push_back( + AutoFillProfileFromWidgetValues(*iter)); + } + + autofill_dialog->observer_->OnAutoFillDialogApply( + autofill_dialog->profiles_, autofill_dialog->credit_cards_); + } + + if (response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_CANCEL) { + gtk_widget_destroy(GTK_WIDGET(dialog)); + } +} + // static void AutoFillDialog::OnAddAddressClicked(GtkButton* button, AutoFillDialog* dialog) { @@ -388,45 +500,61 @@ GtkWidget* AutoFillDialog::InitGroupContentArea(int name_id, } GtkWidget* AutoFillDialog::AddNewAddress() { + AddressWidgets widgets = {0}; GtkWidget* vbox; GtkWidget* address = InitGroupContentArea(IDS_AUTOFILL_NEW_ADDRESS, &vbox); GtkWidget* table = InitFormTable(5, 3); gtk_box_pack_start_defaults(GTK_BOX(vbox), table); - FormTableAddLabelEntry(table, 0, 0, 1, IDS_AUTOFILL_DIALOG_LABEL, - address, G_CALLBACK(OnLabelChanged)); - FormTableAddEntry(table, 1, 0, 1, IDS_AUTOFILL_DIALOG_FIRST_NAME); - FormTableAddEntry(table, 1, 1, 1, IDS_AUTOFILL_DIALOG_MIDDLE_NAME); - FormTableAddEntry(table, 1, 2, 1, IDS_AUTOFILL_DIALOG_LAST_NAME); - FormTableAddEntry(table, 2, 0, 1, IDS_AUTOFILL_DIALOG_EMAIL); - FormTableAddEntry(table, 2, 1, 1, IDS_AUTOFILL_DIALOG_COMPANY_NAME); - FormTableAddEntry(table, 3, 0, 2, IDS_AUTOFILL_DIALOG_ADDRESS_LINE_1); - FormTableAddEntry(table, 4, 0, 2, IDS_AUTOFILL_DIALOG_ADDRESS_LINE_2); + widgets.label = FormTableAddLabelEntry(table, 0, 0, 1, + IDS_AUTOFILL_DIALOG_LABEL, + address, G_CALLBACK(OnLabelChanged)); + widgets.first_name = FormTableAddEntry(table, 1, 0, 1, + IDS_AUTOFILL_DIALOG_FIRST_NAME); + widgets.middle_name = FormTableAddEntry(table, 1, 1, 1, + IDS_AUTOFILL_DIALOG_MIDDLE_NAME); + widgets.last_name = FormTableAddEntry(table, 1, 2, 1, + IDS_AUTOFILL_DIALOG_LAST_NAME); + widgets.email = FormTableAddEntry(table, 2, 0, 1, + IDS_AUTOFILL_DIALOG_EMAIL); + widgets.company_name = FormTableAddEntry(table, 2, 1, 1, + IDS_AUTOFILL_DIALOG_COMPANY_NAME); + widgets.address_line1 = FormTableAddEntry(table, 3, 0, 2, + IDS_AUTOFILL_DIALOG_ADDRESS_LINE_1); + widgets.address_line2 = FormTableAddEntry(table, 4, 0, 2, + IDS_AUTOFILL_DIALOG_ADDRESS_LINE_2); // TODO(jhawkins): If there's not a default profile, automatically check this // check button. GtkWidget* default_check = gtk_check_button_new_with_label( l10n_util::GetStringUTF8(IDS_AUTOFILL_DIALOG_MAKE_DEFAULT).c_str()); + widgets.default_profile = default_check; FormTableSetWidget(table, default_check, 0, 1, 1, false); GtkWidget* address_table = InitFormTable(1, 4); gtk_box_pack_start_defaults(GTK_BOX(vbox), address_table); - FormTableAddEntry(address_table, 0, 0, 1, IDS_AUTOFILL_DIALOG_CITY); - FormTableAddEntry(address_table, 0, 1, 1, IDS_AUTOFILL_DIALOG_STATE); - FormTableAddSizedEntry(address_table, 0, 2, 7, IDS_AUTOFILL_DIALOG_ZIP_CODE); - FormTableAddSizedEntry(address_table, 0, 3, 10, IDS_AUTOFILL_DIALOG_COUNTRY); + widgets.city = FormTableAddEntry(address_table, 0, 0, 1, + IDS_AUTOFILL_DIALOG_CITY); + widgets.state = FormTableAddEntry(address_table, 0, 1, 1, + IDS_AUTOFILL_DIALOG_STATE); + widgets.zipcode = FormTableAddSizedEntry(address_table, 0, 2, 7, + IDS_AUTOFILL_DIALOG_ZIP_CODE); + widgets.country = FormTableAddSizedEntry(address_table, 0, 3, 10, + IDS_AUTOFILL_DIALOG_COUNTRY); GtkWidget* phone_table = InitFormTable(1, 8); gtk_box_pack_start_defaults(GTK_BOX(vbox), phone_table); - FormTableAddSizedEntry(phone_table, 0, 0, 4, IDS_AUTOFILL_DIALOG_PHONE); - FormTableAddSizedEntry(phone_table, 0, 1, 4, 0); - FormTableAddEntry(phone_table, 0, 2, 2, 0); - FormTableAddSizedEntry(phone_table, 0, 4, 4, IDS_AUTOFILL_DIALOG_FAX); - FormTableAddSizedEntry(phone_table, 0, 5, 4, 0); - FormTableAddEntry(phone_table, 0, 6, 2, 0); + widgets.phone1 = FormTableAddSizedEntry(phone_table, 0, 0, 4, + IDS_AUTOFILL_DIALOG_PHONE); + widgets.phone2 = FormTableAddSizedEntry(phone_table, 0, 1, 4, 0); + widgets.phone3 = FormTableAddEntry(phone_table, 0, 2, 2, 0); + widgets.fax1 = FormTableAddSizedEntry(phone_table, 0, 4, 4, + IDS_AUTOFILL_DIALOG_FAX); + widgets.fax2 = FormTableAddSizedEntry(phone_table, 0, 5, 4, 0); + widgets.fax3 = FormTableAddEntry(phone_table, 0, 6, 2, 0); GtkWidget* button = gtk_button_new_with_label( l10n_util::GetStringUTF8(IDS_AUTOFILL_DELETE_BUTTON).c_str()); @@ -434,6 +562,7 @@ GtkWidget* AutoFillDialog::AddNewAddress() { gtk_container_add(GTK_CONTAINER(alignment), button); gtk_box_pack_start_defaults(GTK_BOX(vbox), alignment); + address_widgets_.push_back(widgets); return address; } @@ -511,10 +640,11 @@ GtkWidget* AutoFillDialog::AddNewCreditCard() { /////////////////////////////////////////////////////////////////////////////// // Factory/finder method: -void ShowAutoFillDialog(std::vector<AutoFillProfile>* profiles, - std::vector<FormGroup>* credit_cards) { +void ShowAutoFillDialog(AutoFillDialogObserver* observer, + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards) { if (!dialog) { - dialog = new AutoFillDialog(profiles, credit_cards); + dialog = new AutoFillDialog(observer, profiles, credit_cards); } dialog->Show(); } diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 4f8001a..1fa94d8 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -7,6 +7,7 @@ #include <string> #include "base/command_line.h" +#include "chrome/browser/autofill/autofill_dialog.h" #include "chrome/browser/autofill/autofill_infobar_delegate.h" #include "chrome/browser/autofill/form_structure.h" #include "chrome/browser/autofill/personal_data_manager.h" @@ -59,6 +60,12 @@ void AutoFillManager::FormFieldValuesSubmitted( } } +void AutoFillManager::OnAutoFillDialogApply( + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards) { + // TODO(jhawkins): Pass the profile data onto the PersonalDataManager. +} + void AutoFillManager::DeterminePossibleFieldTypes( FormStructure* form_structure) { // TODO(jhawkins): Update field text. @@ -86,7 +93,11 @@ void AutoFillManager::OnInfoBarAccepted() { PrefService* prefs = tab_contents_->profile()->GetPrefs(); prefs->SetBoolean(prefs::kAutoFillEnabled, true); - // TODO(jhawkins): AutoFillDialog + // TODO(jhawkins): Actually send in the real profiles and credit cards from + // the personal data manager. + std::vector<AutoFillProfile> profiles; + std::vector<CreditCard> credit_cards; + ShowAutoFillDialog(this, profiles, credit_cards); HandleSubmit(); } diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 385c993..eb53517 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -8,6 +8,7 @@ #include <vector> #include "base/scoped_ptr.h" +#include "chrome/browser/autofill/autofill_dialog.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" namespace webkit_glue { @@ -15,6 +16,8 @@ class FormFieldValues; } class AutoFillInfoBarDelegate; +class AutoFillProfile; +class CreditCard; class FormStructure; class PersonalDataManager; class PrefService; @@ -22,7 +25,8 @@ class TabContents; // Manages saving and restoring the user's personal information entered into web // forms. -class AutoFillManager : public RenderViewHostDelegate::AutoFill { +class AutoFillManager : public RenderViewHostDelegate::AutoFill, + AutoFillDialogObserver { public: explicit AutoFillManager(TabContents* tab_contents); virtual ~AutoFillManager(); @@ -30,10 +34,15 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill { // Registers our Enable/Disable AutoFill pref. static void RegisterUserPrefs(PrefService* prefs); - // RenderViewHostDelegate::AutoFill implementation. + // RenderViewHostDelegate::AutoFill implementation: virtual void FormFieldValuesSubmitted( const webkit_glue::FormFieldValues& form); + // AutoFillDialogObserver implementation: + virtual void OnAutoFillDialogApply( + const std::vector<AutoFillProfile>& profiles, + const std::vector<CreditCard>& credit_cards); + // Uses heuristics and existing personal data to determine the possible field // types. void DeterminePossibleFieldTypes(FormStructure* form_structure); diff --git a/chrome/browser/autofill/credit_card.cc b/chrome/browser/autofill/credit_card.cc index 00d183d..fb679a7 100644 --- a/chrome/browser/autofill/credit_card.cc +++ b/chrome/browser/autofill/credit_card.cc @@ -29,6 +29,17 @@ CreditCard::CreditCard(const string16& label) label_(label) { } +CreditCard::CreditCard(const CreditCard& card) + : number_(card.number_), + name_on_card_(card.name_on_card_), + type_(card.type_), + verification_code_(card.verification_code_), + last_four_digits_(card.last_four_digits_), + expiration_month_(card.expiration_month_), + expiration_year_(card.expiration_year_), + label_(card.label_) { +} + FormGroup* CreditCard::Clone() const { return new CreditCard(*this); } @@ -243,17 +254,6 @@ void CreditCard::set_expiration_year(int expiration_year) { expiration_year_ = expiration_year; } -CreditCard::CreditCard(const CreditCard& card) - : number_(card.number_), - name_on_card_(card.name_on_card_), - type_(card.type_), - verification_code_(card.verification_code_), - last_four_digits_(card.last_four_digits_), - expiration_month_(card.expiration_month_), - expiration_year_(card.expiration_year_), - label_(card.label_) { -} - bool CreditCard::FindInfoMatchesHelper(const AutoFillFieldType& field_type, const string16& info, string16* match) const { diff --git a/chrome/browser/autofill/credit_card.h b/chrome/browser/autofill/credit_card.h index d686bbc..7d3cbe9 100644 --- a/chrome/browser/autofill/credit_card.h +++ b/chrome/browser/autofill/credit_card.h @@ -14,6 +14,8 @@ class CreditCard : public FormGroup { public: explicit CreditCard(const string16& label); + // Used for STL. + explicit CreditCard(const CreditCard& card); // FormGroup implementation: FormGroup* Clone() const; @@ -66,7 +68,6 @@ class CreditCard : public FormGroup { void set_expiration_year(int expiration_year); private: - explicit CreditCard(const CreditCard& card); void operator=(const CreditCard& card); // A helper function for FindInfoMatches that only handles matching the info diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index eeb615a..79b73c0 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -85,6 +85,7 @@ 'browser/autofill/address.cc', 'browser/autofill/address.h', 'browser/autofill/autofill_dialog_gtk.cc', + 'browser/autofill/autofill_dialog.cc', 'browser/autofill/autofill_dialog.h', 'browser/autofill/autofill_field.cc', 'browser/autofill/autofill_field.h', |