diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-10 12:29:21 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-10 12:29:21 +0000 |
commit | e90c2256aed9c209b5a1cc5db4ef0975ab64490b (patch) | |
tree | 486c9924987a95ac33a0dc4f6054a678b717ef7c /chrome | |
parent | 987d99ce11821cfd4af42b3a718d1dbfe8587817 (diff) | |
download | chromium_src-e90c2256aed9c209b5a1cc5db4ef0975ab64490b.zip chromium_src-e90c2256aed9c209b5a1cc5db4ef0975ab64490b.tar.gz chromium_src-e90c2256aed9c209b5a1cc5db4ef0975ab64490b.tar.bz2 |
autofill: Rename AutoFillProfile to AutofillProfile.
BUG=72758
TEST=existing unit_tests
Review URL: http://codereview.chromium.org/6658030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
53 files changed, 991 insertions, 991 deletions
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index a29e93b1..4001dd4 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -76,7 +76,7 @@ class AutoFillTest : public InProcessBrowserTest { void CreateTestProfile() { autofill_test::DisableSystemServices(browser()->profile()); - AutoFillProfile profile; + AutofillProfile profile; autofill_test::SetProfileInfo( &profile, "Milton", "C.", "Waddams", "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", @@ -87,7 +87,7 @@ class AutoFillTest : public InProcessBrowserTest { browser()->profile()->GetPersonalDataManager(); ASSERT_TRUE(personal_data_manager); - std::vector<AutoFillProfile> profiles(1, profile); + std::vector<AutofillProfile> profiles(1, profile); personal_data_manager->SetProfiles(&profiles); } diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc index bc0cac9..1a67781 100644 --- a/chrome/browser/autofill/autofill_common_test.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -31,7 +31,7 @@ inline void check_and_set( profile->SetInfo(AutofillType(type), ASCIIToUTF16(value)); } -void SetProfileInfo(AutoFillProfile* profile, +void SetProfileInfo(AutofillProfile* profile, const char* first_name, const char* middle_name, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, @@ -52,7 +52,7 @@ void SetProfileInfo(AutoFillProfile* profile, check_and_set(profile, PHONE_FAX_WHOLE_NUMBER, fax); } -void SetProfileInfoWithGuid(AutoFillProfile* profile, +void SetProfileInfoWithGuid(AutofillProfile* profile, const char* guid, const char* first_name, const char* middle_name, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, diff --git a/chrome/browser/autofill/autofill_common_test.h b/chrome/browser/autofill/autofill_common_test.h index 72f0a14..0d977f8 100644 --- a/chrome/browser/autofill/autofill_common_test.h +++ b/chrome/browser/autofill/autofill_common_test.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ #pragma once -class AutoFillProfile; +class AutofillProfile; class CreditCard; class Profile; @@ -27,14 +27,14 @@ void CreateTestFormField(const char* label, // A unit testing utility that is common to a number of the AutoFill unit // tests. |SetProfileInfo| provides a quick way to populate a profile with // c-strings. -void SetProfileInfo(AutoFillProfile* profile, +void SetProfileInfo(AutofillProfile* profile, const char* first_name, const char* middle_name, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, const char* state, const char* zipcode, const char* country, const char* phone, const char* fax); -void SetProfileInfoWithGuid(AutoFillProfile* profile, +void SetProfileInfoWithGuid(AutofillProfile* profile, const char* guid, const char* first_name, const char* middle_name, const char* last_name, const char* email, const char* company, const char* address1, const char* address2, const char* city, diff --git a/chrome/browser/autofill/autofill_dialog.h b/chrome/browser/autofill/autofill_dialog.h index fccac70..1f56c03 100644 --- a/chrome/browser/autofill/autofill_dialog.h +++ b/chrome/browser/autofill/autofill_dialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -23,7 +23,7 @@ class AutoFillDialogObserver { // existing data. For example, |OnAutoFillDialogApply(new_profiles, NULL)| // only sets the profiles and not the credit cards. virtual void OnAutoFillDialogApply( - std::vector<AutoFillProfile>* profiles, + std::vector<AutofillProfile>* profiles, std::vector<CreditCard>* credit_cards) = 0; protected: diff --git a/chrome/browser/autofill/autofill_dialog_gtk.cc b/chrome/browser/autofill/autofill_dialog_gtk.cc index ed04445..7428ea9 100644 --- a/chrome/browser/autofill/autofill_dialog_gtk.cc +++ b/chrome/browser/autofill/autofill_dialog_gtk.cc @@ -39,12 +39,12 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/gtk_util.h" -// Shows the editor for adding/editing an AutoFillProfile. If -// |auto_fill_profile| is NULL, a new AutoFillProfile should be created. -void ShowAutoFillProfileEditor(gfx::NativeView parent, +// Shows the editor for adding/editing an AutofillProfile. If +// |auto_fill_profile| is NULL, a new AutofillProfile should be created. +void ShowAutofillProfileEditor(gfx::NativeView parent, AutoFillDialogObserver* observer, Profile* profile, - AutoFillProfile* auto_fill_profile); + AutofillProfile* auto_fill_profile); // Shows the editor for adding/editing a CreditCard. If |credit_card| is NULL, a // new CreditCard should be created. @@ -147,13 +147,13 @@ class AutoFillDialog : public PersonalDataManager::Observer, // Returns a bitmask of the selection types. int GetSelectionType(); - void AddAddressToTree(const AutoFillProfile& profile, GtkTreeIter* iter); + void AddAddressToTree(const AutofillProfile& profile, GtkTreeIter* iter); void AddCreditCardToTree(const CreditCard& credit_card, GtkTreeIter* iter); // Returns the set of selected profiles and cards. The values placed in // the specified vectors are owned by PersonalDataManager. - void GetSelectedEntries(std::vector<AutoFillProfile*>* profiles, + void GetSelectedEntries(std::vector<AutofillProfile*>* profiles, std::vector<CreditCard*>* cards); Profile* profile_; @@ -297,7 +297,7 @@ gboolean AutoFillDialog::OnCheckRowIsSeparator(GtkTreeModel* model, } void AutoFillDialog::OnAddAddress(GtkWidget* widget) { - ShowAutoFillProfileEditor(NULL, observer_, profile_, NULL); + ShowAutofillProfileEditor(NULL, observer_, profile_, NULL); } void AutoFillDialog::OnAddCreditCard(GtkWidget* widget) { @@ -307,26 +307,26 @@ void AutoFillDialog::OnAddCreditCard(GtkWidget* widget) { void AutoFillDialog::OnEdit(GtkWidget* widget) { DCHECK_EQ(SELECTION_SINGLE, GetSelectionType()); - std::vector<AutoFillProfile*> profiles; + std::vector<AutofillProfile*> profiles; std::vector<CreditCard*> cards; GetSelectedEntries(&profiles, &cards); if (profiles.size() == 1) - ShowAutoFillProfileEditor(dialog_, observer_, profile_, profiles[0]); + ShowAutofillProfileEditor(dialog_, observer_, profile_, profiles[0]); else if (cards.size() == 1) ShowAutoFillCreditCardEditor(dialog_, observer_, profile_, cards[0]); } void AutoFillDialog::OnRemove(GtkWidget* widget) { PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); - std::vector<AutoFillProfile*> selected_profiles; + std::vector<AutofillProfile*> selected_profiles; std::vector<CreditCard*> selected_cards; GetSelectedEntries(&selected_profiles, &selected_cards); - std::vector<AutoFillProfile> profiles; - for (std::vector<AutoFillProfile*>::const_iterator i = + std::vector<AutofillProfile> profiles; + for (std::vector<AutofillProfile*>::const_iterator i = data_manager->profiles().begin(); i != data_manager->profiles().end(); ++i) { if (std::find(selected_profiles.begin(), selected_profiles.end(), *i) == @@ -400,7 +400,7 @@ void AutoFillDialog::LoadAutoFillData() { // The addresses. profile_count_ = 0; - for (std::vector<AutoFillProfile*>::const_iterator i = + for (std::vector<AutofillProfile*>::const_iterator i = personal_data_->profiles().begin(); i != personal_data_->profiles().end(); ++i) { AddAddressToTree(*(*i), &iter); @@ -605,7 +605,7 @@ int AutoFillDialog::GetSelectionType() { return state; } -void AutoFillDialog::AddAddressToTree(const AutoFillProfile& profile, +void AutoFillDialog::AddAddressToTree(const AutofillProfile& profile, GtkTreeIter* iter) { gtk_list_store_append(list_store_, iter); gtk_list_store_set( @@ -628,7 +628,7 @@ void AutoFillDialog::AddCreditCardToTree(const CreditCard& credit_card, } void AutoFillDialog::GetSelectedEntries( - std::vector<AutoFillProfile*>* profiles, + std::vector<AutofillProfile*>* profiles, std::vector<CreditCard*>* cards) { std::set<int> selection; gtk_tree::GetSelectedIndices( diff --git a/chrome/browser/autofill/autofill_editor_gtk.cc b/chrome/browser/autofill/autofill_editor_gtk.cc index 11f2184f..42b555d 100644 --- a/chrome/browser/autofill/autofill_editor_gtk.cc +++ b/chrome/browser/autofill/autofill_editor_gtk.cc @@ -148,19 +148,19 @@ bool IsValidPhoneNumber(GtkWidget* widget) { return PhoneNumber::ParsePhoneNumber(text, &number, &city_code,&country_code); } -// AutoFillProfileEditor ------------------------------------------------------- +// AutofillProfileEditor ------------------------------------------------------- -// Class responsible for editing or creating an AutoFillProfile. -class AutoFillProfileEditor { +// Class responsible for editing or creating an AutofillProfile. +class AutofillProfileEditor { public: - AutoFillProfileEditor(AutoFillDialogObserver* observer, + AutofillProfileEditor(AutoFillDialogObserver* observer, Profile* profile, - AutoFillProfile* auto_fill_profile); + AutofillProfile* auto_fill_profile); private: - friend class DeleteTask<AutoFillProfileEditor>; + friend class DeleteTask<AutofillProfileEditor>; - virtual ~AutoFillProfileEditor() {} + virtual ~AutofillProfileEditor() {} void Init(); @@ -168,15 +168,15 @@ class AutoFillProfileEditor { void RegisterForTextChanged(); // Sets the values of the various widgets to |profile|. - void SetWidgetValues(AutoFillProfile* profile); + void SetWidgetValues(AutofillProfile* profile); // Notifies the observer of the new changes. This either updates the current - // AutoFillProfile or creates a new one. + // AutofillProfile or creates a new one. void ApplyEdits(); // Sets the various form fields in |profile| to match the values in the // widgets. - void SetProfileValuesFromWidgets(AutoFillProfile* profile); + void SetProfileValuesFromWidgets(AutofillProfile* profile); // Updates the image displayed by |image| depending upon whether the text in // |entry| is a valid phone number. @@ -190,11 +190,11 @@ class AutoFillProfileEditor { // Updates the enabled state of the ok button. void UpdateOkButton(); - CHROMEGTK_CALLBACK_0(AutoFillProfileEditor, void, OnDestroy); - CHROMEGTK_CALLBACK_1(AutoFillProfileEditor, void, OnResponse, int); - CHROMEG_CALLBACK_0(AutoFillProfileEditor, void, OnPhoneChanged, GtkEditable*); - CHROMEG_CALLBACK_0(AutoFillProfileEditor, void, OnFaxChanged, GtkEditable*); - CHROMEG_CALLBACK_0(AutoFillProfileEditor, void, OnFieldChanged, GtkEditable*); + CHROMEGTK_CALLBACK_0(AutofillProfileEditor, void, OnDestroy); + CHROMEGTK_CALLBACK_1(AutofillProfileEditor, void, OnResponse, int); + CHROMEG_CALLBACK_0(AutofillProfileEditor, void, OnPhoneChanged, GtkEditable*); + CHROMEG_CALLBACK_0(AutofillProfileEditor, void, OnFaxChanged, GtkEditable*); + CHROMEG_CALLBACK_0(AutofillProfileEditor, void, OnFieldChanged, GtkEditable*); // Are we creating a new profile? const bool is_new_; @@ -223,13 +223,13 @@ class AutoFillProfileEditor { GtkWidget* email_; GtkWidget* ok_button_; - DISALLOW_COPY_AND_ASSIGN(AutoFillProfileEditor); + DISALLOW_COPY_AND_ASSIGN(AutofillProfileEditor); }; -AutoFillProfileEditor::AutoFillProfileEditor( +AutofillProfileEditor::AutofillProfileEditor( AutoFillDialogObserver* observer, Profile* profile, - AutoFillProfile* auto_fill_profile) + AutofillProfile* auto_fill_profile) : is_new_(!auto_fill_profile ? true : false), profile_guid_(auto_fill_profile ? auto_fill_profile->guid() : std::string()), @@ -252,7 +252,7 @@ AutoFillProfileEditor::AutoFillProfileEditor( gtk_util::PresentWindow(dialog_, gtk_get_current_event_time()); } -void AutoFillProfileEditor::Init() { +void AutofillProfileEditor::Init() { TableBuilder main_table_builder(15, 2); main_table_builder.AddWidget(CreateLabel(IDS_AUTOFILL_DIALOG_FULL_NAME), 2); @@ -342,7 +342,7 @@ void AutoFillProfileEditor::Init() { main_table_builder.table(), TRUE, TRUE, 0); } -void AutoFillProfileEditor::RegisterForTextChanged() { +void AutofillProfileEditor::RegisterForTextChanged() { g_signal_connect(full_name_, "changed", G_CALLBACK(OnFieldChangedThunk), this); g_signal_connect(company_, "changed", G_CALLBACK(OnFieldChangedThunk), @@ -360,7 +360,7 @@ void AutoFillProfileEditor::RegisterForTextChanged() { g_signal_connect(fax_, "changed", G_CALLBACK(OnFieldChangedThunk), this); } -void AutoFillProfileEditor::SetWidgetValues(AutoFillProfile* profile) { +void AutofillProfileEditor::SetWidgetValues(AutofillProfile* profile) { SetEntryText(full_name_, profile, NAME_FULL); SetEntryText(company_, profile, COMPANY_NAME); SetEntryText(address_1_, profile, ADDRESS_HOME_LINE1); @@ -377,20 +377,20 @@ void AutoFillProfileEditor::SetWidgetValues(AutoFillProfile* profile) { UpdatePhoneImage(fax_, fax_image_); } -void AutoFillProfileEditor::ApplyEdits() { +void AutofillProfileEditor::ApplyEdits() { // Build the current set of profiles. - std::vector<AutoFillProfile> profiles; + std::vector<AutofillProfile> profiles; PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); - for (std::vector<AutoFillProfile*>::const_iterator i = + for (std::vector<AutofillProfile*>::const_iterator i = data_manager->profiles().begin(); i != data_manager->profiles().end(); ++i) { profiles.push_back(**i); } - AutoFillProfile* profile = NULL; + AutofillProfile* profile = NULL; if (!is_new_) { // The user is editing an existing profile, find it. - for (std::vector<AutoFillProfile>::iterator i = profiles.begin(); + for (std::vector<AutofillProfile>::iterator i = profiles.begin(); i != profiles.end(); ++i) { if (i->guid() == profile_guid_) { profile = &(*i); @@ -402,7 +402,7 @@ void AutoFillProfileEditor::ApplyEdits() { } if (!profile) { - profiles.push_back(AutoFillProfile()); + profiles.push_back(AutofillProfile()); profile = &profiles.back(); } @@ -413,8 +413,8 @@ void AutoFillProfileEditor::ApplyEdits() { observer_->OnAutoFillDialogApply(&profiles, NULL); } -void AutoFillProfileEditor::SetProfileValuesFromWidgets( - AutoFillProfile* profile) { +void AutofillProfileEditor::SetProfileValuesFromWidgets( + AutofillProfile* profile) { SetFormValue(full_name_, profile, NAME_FULL); SetFormValue(company_, profile, COMPANY_NAME); SetFormValue(address_1_, profile, ADDRESS_HOME_LINE1); @@ -439,7 +439,7 @@ void AutoFillProfileEditor::SetProfileValuesFromWidgets( profile->SetInfo(AutofillType(PHONE_FAX_NUMBER), number); } -void AutoFillProfileEditor::UpdatePhoneImage(GtkWidget* entry, +void AutofillProfileEditor::UpdatePhoneImage(GtkWidget* entry, GtkWidget* image) { string16 number, city_code, country_code; string16 text(GetEntryText(entry)); @@ -457,7 +457,7 @@ void AutoFillProfileEditor::UpdatePhoneImage(GtkWidget* entry, } } -void AutoFillProfileEditor::SetPhoneSizeRequest(GtkWidget* widget) { +void AutofillProfileEditor::SetPhoneSizeRequest(GtkWidget* widget) { GdkPixbuf* buf = ResourceBundle::GetSharedInstance().GetPixbufNamed(IDR_INPUT_ALERT); gtk_widget_set_size_request(widget, @@ -465,7 +465,7 @@ void AutoFillProfileEditor::SetPhoneSizeRequest(GtkWidget* widget) { gdk_pixbuf_get_height(buf)); } -void AutoFillProfileEditor::UpdateOkButton() { +void AutofillProfileEditor::UpdateOkButton() { // Enable the ok button if at least one field is non-empty and the phone // numbers are valid. bool valid = @@ -488,11 +488,11 @@ void AutoFillProfileEditor::UpdateOkButton() { gtk_widget_set_sensitive(ok_button_, valid); } -void AutoFillProfileEditor::OnDestroy(GtkWidget* widget) { +void AutofillProfileEditor::OnDestroy(GtkWidget* widget) { MessageLoop::current()->DeleteSoon(FROM_HERE, this); } -void AutoFillProfileEditor::OnResponse(GtkWidget* dialog, int response_id) { +void AutofillProfileEditor::OnResponse(GtkWidget* dialog, int response_id) { if (response_id == GTK_RESPONSE_APPLY || response_id == GTK_RESPONSE_OK) ApplyEdits(); @@ -504,15 +504,15 @@ void AutoFillProfileEditor::OnResponse(GtkWidget* dialog, int response_id) { } } -void AutoFillProfileEditor::OnPhoneChanged(GtkEditable* editable) { +void AutofillProfileEditor::OnPhoneChanged(GtkEditable* editable) { UpdatePhoneImage(phone_, phone_image_); } -void AutoFillProfileEditor::OnFaxChanged(GtkEditable* editable) { +void AutofillProfileEditor::OnFaxChanged(GtkEditable* editable) { UpdatePhoneImage(fax_, fax_image_); } -void AutoFillProfileEditor::OnFieldChanged(GtkEditable* editable) { +void AutofillProfileEditor::OnFieldChanged(GtkEditable* editable) { UpdateOkButton(); } @@ -858,12 +858,12 @@ void AutoFillCreditCardEditor::OnInsertTextIntoNumber(GtkEditable* editable, } // namespace -void ShowAutoFillProfileEditor(gfx::NativeView parent, +void ShowAutofillProfileEditor(gfx::NativeView parent, AutoFillDialogObserver* observer, Profile* profile, - AutoFillProfile* auto_fill_profile) { - // AutoFillProfileEditor takes care of deleting itself. - new AutoFillProfileEditor(observer, profile, auto_fill_profile); + AutofillProfile* auto_fill_profile) { + // AutofillProfileEditor takes care of deleting itself. + new AutofillProfileEditor(observer, profile, auto_fill_profile); } void ShowAutoFillCreditCardEditor(gfx::NativeView parent, diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc index 39b985a..adc9a4a 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc @@ -18,7 +18,7 @@ using base::win::RegKey; // Forward declaration. This function is not in unnamed namespace as it // is referenced in the unittest. -bool ImportCurrentUserProfiles(std::vector<AutoFillProfile>* profiles, +bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, std::vector<CreditCard>* credit_cards); namespace { @@ -177,7 +177,7 @@ class AutoFillImporter : public PersonalDataManager::Observer { } PersonalDataManager* personal_data_manager_; - std::vector<AutoFillProfile> profiles_; + std::vector<AutofillProfile> profiles_; std::vector<CreditCard> credit_cards_; }; @@ -186,7 +186,7 @@ class AutoFillImporter : public PersonalDataManager::Observer { // Imports AutoFill profiles and credit cards from IE Toolbar if present and not // password protected. Returns true if data is successfully retrieved. False if // there is no data, data is password protected or error occurred. -bool ImportCurrentUserProfiles(std::vector<AutoFillProfile>* profiles, +bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, std::vector<CreditCard>* credit_cards) { DCHECK(profiles); DCHECK(credit_cards); @@ -205,7 +205,7 @@ bool ImportCurrentUserProfiles(std::vector<AutoFillProfile>* profiles, key_name.append(L"\\"); key_name.append(iterator_profiles.Name()); RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ); - AutoFillProfile profile; + AutofillProfile profile; if (ImportSingleProfile(&profile, &key, reg_to_field)) { // Combine phones into whole phone #. string16 phone; diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc index 86e13b8..f407ad7 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc @@ -16,7 +16,7 @@ using base::win::RegKey; // Defined in autofill_ie_toolbar_import_win.cc. Not exposed in the header file. -bool ImportCurrentUserProfiles(std::vector<AutoFillProfile>* profiles, +bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, std::vector<CreditCard>* credit_cards); namespace { @@ -158,7 +158,7 @@ TEST_F(AutofillIeToolbarImportTest, TestAutoFillImport) { profile_key.Close(); cc_key.Close(); - std::vector<AutoFillProfile> profiles; + std::vector<AutofillProfile> profiles; std::vector<CreditCard> credit_cards; EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); ASSERT_EQ(profiles.size(), 2); diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 6fb1d9f..9e1a476 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -387,7 +387,7 @@ void AutofillManager::OnFillAutoFillFormData(int query_id, const FormData& form, const FormField& field, int unique_id) { - const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles(); + const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); RenderViewHost* host = NULL; FormStructure* form_structure = NULL; @@ -407,9 +407,9 @@ void AutofillManager::OnFillAutoFillFormData(int query_id, DCHECK(!guid::IsValidGUID(cc_guid) || !guid::IsValidGUID(profile_guid)); // Find the profile that matches the |profile_id|, if one is specified. - const AutoFillProfile* profile = NULL; + const AutofillProfile* profile = NULL; if (guid::IsValidGUID(profile_guid)) { - for (std::vector<AutoFillProfile*>::const_iterator iter = profiles.begin(); + for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin(); iter != profiles.end(); ++iter) { if ((*iter)->guid() == profile_guid) { profile = *iter; @@ -720,7 +720,7 @@ void AutofillManager::set_metric_logger( metric_logger_.reset(metric_logger); } -bool AutofillManager::GetHost(const std::vector<AutoFillProfile*>& profiles, +bool AutofillManager::GetHost(const std::vector<AutofillProfile*>& profiles, const std::vector<CreditCard*>& credit_cards, RenderViewHost** host) { if (!IsAutoFillEnabled()) @@ -797,11 +797,11 @@ void AutofillManager::GetProfileSuggestions(FormStructure* form, std::vector<string16>* labels, std::vector<string16>* icons, std::vector<int>* unique_ids) { - const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles(); - std::vector<AutoFillProfile*> matched_profiles; - for (std::vector<AutoFillProfile*>::const_iterator iter = profiles.begin(); + const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); + std::vector<AutofillProfile*> matched_profiles; + for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin(); iter != profiles.end(); ++iter) { - AutoFillProfile* profile = *iter; + AutofillProfile* profile = *iter; // The value of the stored data for this field type in the |profile|. string16 profile_field_value = profile->GetFieldText(type); @@ -825,7 +825,7 @@ void AutofillManager::GetProfileSuggestions(FormStructure* form, form_fields.push_back((*iter)->type()); } - AutoFillProfile::CreateInferredLabels(&matched_profiles, &form_fields, + AutofillProfile::CreateInferredLabels(&matched_profiles, &form_fields, type.field_type(), 1, labels); // No icons for profile suggestions. @@ -893,7 +893,7 @@ void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, } } -void AutofillManager::FillFormField(const AutoFillProfile* profile, +void AutofillManager::FillFormField(const AutofillProfile* profile, AutofillType type, webkit_glue::FormField* field) { DCHECK(profile); @@ -910,7 +910,7 @@ void AutofillManager::FillFormField(const AutoFillProfile* profile, } } -void AutofillManager::FillPhoneNumberField(const AutoFillProfile* profile, +void AutofillManager::FillPhoneNumberField(const AutofillProfile* profile, AutofillType type, webkit_glue::FormField* field) { // If we are filling a phone number, check to see if the size field diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index c2d93d7..7760f12 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -19,7 +19,7 @@ #include "content/browser/tab_contents/tab_contents_observer.h" class AutoFillCCInfoBarDelegate; -class AutoFillProfile; +class AutofillProfile; class AutofillMetrics; class CreditCard; class FormStructure; @@ -117,7 +117,7 @@ class AutofillManager : public TabContentsObserver, // Fills |host| with the RenderViewHost for this tab. // Returns false if Autofill is disabled or if the host is unavailable. - bool GetHost(const std::vector<AutoFillProfile*>& profiles, + bool GetHost(const std::vector<AutofillProfile*>& profiles, const std::vector<CreditCard*>& credit_cards, RenderViewHost** host) WARN_UNUSED_RESULT; @@ -163,13 +163,13 @@ class AutofillManager : public TabContentsObserver, webkit_glue::FormField* field); // Set |field| argument's value based on |type| and contents of the |profile|. - void FillFormField(const AutoFillProfile* profile, + void FillFormField(const AutofillProfile* profile, AutofillType type, webkit_glue::FormField* field); // Set |field| argument's value for phone/fax number based on contents of the // |profile|. |type| is the type of the phone. - void FillPhoneNumberField(const AutoFillProfile* profile, + void FillPhoneNumberField(const AutofillProfile* profile, AutofillType type, webkit_glue::FormField* field); diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index ed23d54..cea6dd3 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -52,7 +52,7 @@ typedef Tuple5<int, class TestPersonalDataManager : public PersonalDataManager { public: TestPersonalDataManager() { - CreateTestAutoFillProfiles(&web_profiles_); + CreateTestAutofillProfiles(&web_profiles_); CreateTestCreditCards(&credit_cards_); } @@ -60,8 +60,8 @@ class TestPersonalDataManager : public PersonalDataManager { virtual void SaveImportedFormData() {} virtual bool IsDataLoaded() const { return true; } - AutoFillProfile* GetProfileWithGUID(const char* guid) { - for (std::vector<AutoFillProfile *>::iterator it = web_profiles_.begin(); + AutofillProfile* GetProfileWithGUID(const char* guid) { + for (std::vector<AutofillProfile *>::iterator it = web_profiles_.begin(); it != web_profiles_.end(); ++it) { if (!(*it)->guid().compare(guid)) return *it; @@ -69,11 +69,11 @@ class TestPersonalDataManager : public PersonalDataManager { return NULL; } - void AddProfile(AutoFillProfile* profile) { + void AddProfile(AutofillProfile* profile) { web_profiles_->push_back(profile); } - void ClearAutoFillProfiles() { + void ClearAutofillProfiles() { web_profiles_.reset(); } @@ -92,8 +92,8 @@ class TestPersonalDataManager : public PersonalDataManager { } private: - void CreateTestAutoFillProfiles(ScopedVector<AutoFillProfile>* profiles) { - AutoFillProfile* profile = new AutoFillProfile; + void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { + AutofillProfile* profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Elvis", "Aaron", "Presley", "theking@gmail.com", "RCA", "3734 Elvis Presley Blvd.", "Apt. 10", @@ -101,7 +101,7 @@ class TestPersonalDataManager : public PersonalDataManager { "12345678901", ""); profile->set_guid("00000000-0000-0000-0000-000000000001"); profiles->push_back(profile); - profile = new AutoFillProfile; + profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Charles", "Hardin", "Holley", "buddy@gmail.com", "Decca", "123 Apple St.", "unit 6", "Lubbock", @@ -109,7 +109,7 @@ class TestPersonalDataManager : public PersonalDataManager { ""); profile->set_guid("00000000-0000-0000-0000-000000000002"); profiles->push_back(profile); - profile = new AutoFillProfile; + profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "", "", "", "", "", "", "", "", "", "", "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000003"); @@ -417,11 +417,11 @@ class TestAutofillManager : public AutofillManager { autofill_enabled_ = autofill_enabled; } - AutoFillProfile* GetProfileWithGUID(const char* guid) { + AutofillProfile* GetProfileWithGUID(const char* guid) { return test_personal_data_->GetProfileWithGUID(guid); } - void AddProfile(AutoFillProfile* profile) { + void AddProfile(AutofillProfile* profile) { test_personal_data_->AddProfile(profile); } @@ -672,8 +672,8 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsWithDuplicates) { FormsSeen(forms); // Add a duplicate profile. - AutoFillProfile* duplicate_profile = - new AutoFillProfile( + AutofillProfile* duplicate_profile = + new AutofillProfile( *(autofill_manager_->GetProfileWithGUID( "00000000-0000-0000-0000-000000000001"))); autofill_manager_->AddProfile(duplicate_profile); @@ -787,7 +787,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMethodGet) { expected_labels2, expected_icons2, expected_unique_ids2); // Now clear the test profiles and try again -- we shouldn't return a warning. - test_personal_data_->ClearAutoFillProfiles(); + test_personal_data_->ClearAutofillProfiles(); GetAutoFillSuggestions(form, field); EXPECT_FALSE(GetAutoFillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); } @@ -1260,7 +1260,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWithDuplicateValues) { FormsSeen(forms); // |profile| will be owned by the mock PersonalDataManager. - AutoFillProfile* profile = new AutoFillProfile; + AutofillProfile* profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Elvis", "", "", "", "", "", "", "", "", "", "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000101"); @@ -1638,7 +1638,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { std::vector<FormData> forms(1, form); FormsSeen(forms); - AutoFillProfile *work_profile = autofill_manager_->GetProfileWithGUID( + AutofillProfile *work_profile = autofill_manager_->GetProfileWithGUID( "00000000-0000-0000-0000-000000000002"); ASSERT_TRUE(work_profile != NULL); const AutofillType phone_type(PHONE_HOME_NUMBER); diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index b5897f2..a89be10 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -44,7 +44,7 @@ const AutofillFieldType kProfileFieldTypes[] = { }; // Serializes the |profiles| into a string. -std::string SerializeProfiles(const std::vector<AutoFillProfile*>& profiles) { +std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { std::string result; for (size_t i = 0; i < profiles.size(); ++i) { result += kProfileSeparator; @@ -70,11 +70,11 @@ class PersonalDataManagerMock : public PersonalDataManager { void Reset(); // PersonalDataManager: - virtual void SaveImportedProfile(const AutoFillProfile& profile) OVERRIDE; - virtual const std::vector<AutoFillProfile*>& web_profiles() OVERRIDE; + virtual void SaveImportedProfile(const AutofillProfile& profile) OVERRIDE; + virtual const std::vector<AutofillProfile*>& web_profiles() OVERRIDE; private: - ScopedVector<AutoFillProfile> profiles_; + ScopedVector<AutofillProfile> profiles_; DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerMock); }; @@ -90,13 +90,13 @@ void PersonalDataManagerMock::Reset() { } void PersonalDataManagerMock::SaveImportedProfile( - const AutoFillProfile& profile) { - std::vector<AutoFillProfile> profiles; + const AutofillProfile& profile) { + std::vector<AutofillProfile> profiles; if (!MergeProfile(profile, profiles_.get(), &profiles)) - profiles_.push_back(new AutoFillProfile(profile)); + profiles_.push_back(new AutofillProfile(profile)); } -const std::vector<AutoFillProfile*>& PersonalDataManagerMock::web_profiles() { +const std::vector<AutofillProfile*>& PersonalDataManagerMock::web_profiles() { return profiles_.get(); } diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc index 44f0db5..e8d5446 100644 --- a/chrome/browser/autofill/autofill_metrics_unittest.cc +++ b/chrome/browser/autofill/autofill_metrics_unittest.cc @@ -42,7 +42,7 @@ class TestPersonalDataManager : public PersonalDataManager { public: TestPersonalDataManager() { set_metric_logger(new MockAutofillMetrics); - CreateTestAutoFillProfiles(&web_profiles_); + CreateTestAutofillProfiles(&web_profiles_); CreateTestCreditCards(&credit_cards_); } @@ -53,16 +53,16 @@ class TestPersonalDataManager : public PersonalDataManager { // Overridden to avoid a trip to the database. This should be a no-op except // for the side-effect of logging the profile count. virtual void LoadProfiles() { - std::vector<AutoFillProfile*> profiles; + std::vector<AutofillProfile*> profiles; web_profiles_.release(&profiles); - WDResult<std::vector<AutoFillProfile*> > result(AUTOFILL_PROFILES_RESULT, + WDResult<std::vector<AutofillProfile*> > result(AUTOFILL_PROFILES_RESULT, profiles); ReceiveLoadedProfiles(0, &result); } // Adds |profile| to |web_profiles_| and takes ownership of the profile's // memory. - virtual void AddProfile(AutoFillProfile* profile) { + virtual void AddProfile(AutofillProfile* profile) { web_profiles_.push_back(profile); } @@ -76,8 +76,8 @@ class TestPersonalDataManager : public PersonalDataManager { } private: - void CreateTestAutoFillProfiles(ScopedVector<AutoFillProfile>* profiles) { - AutoFillProfile* profile = new AutoFillProfile; + void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { + AutofillProfile* profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Elvis", "Aaron", "Presley", "theking@gmail.com", "RCA", "3734 Elvis Presley Blvd.", "Apt. 10", @@ -85,7 +85,7 @@ class TestPersonalDataManager : public PersonalDataManager { "12345678901", ""); profile->set_guid("00000000-0000-0000-0000-000000000001"); profiles->push_back(profile); - profile = new AutoFillProfile; + profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "Charles", "Hardin", "Holley", "buddy@gmail.com", "Decca", "123 Apple St.", "unit 6", "Lubbock", @@ -93,7 +93,7 @@ class TestPersonalDataManager : public PersonalDataManager { ""); profile->set_guid("00000000-0000-0000-0000-000000000002"); profiles->push_back(profile); - profile = new AutoFillProfile; + profile = new AutofillProfile; autofill_test::SetProfileInfo(profile, "", "", "", "", "", "", "", "", "", "", "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000003"); diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc index 16e7332..5aa474a 100644 --- a/chrome/browser/autofill/autofill_profile.cc +++ b/chrome/browser/autofill/autofill_profile.cc @@ -100,23 +100,23 @@ void GetFieldsForDistinguishingProfiles( } // namespace -AutoFillProfile::AutoFillProfile(const std::string& guid) +AutofillProfile::AutofillProfile(const std::string& guid) : guid_(guid) { } -AutoFillProfile::AutoFillProfile() +AutofillProfile::AutofillProfile() : guid_(guid::GenerateGUID()) { } -AutoFillProfile::AutoFillProfile(const AutoFillProfile& source) +AutofillProfile::AutofillProfile(const AutofillProfile& source) : FormGroup() { operator=(source); } -AutoFillProfile::~AutoFillProfile() { +AutofillProfile::~AutofillProfile() { } -AutoFillProfile& AutoFillProfile::operator=(const AutoFillProfile& profile) { +AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) { if (this == &profile) return *this; @@ -133,7 +133,7 @@ AutoFillProfile& AutoFillProfile::operator=(const AutoFillProfile& profile) { return *this; } -void AutoFillProfile::GetPossibleFieldTypes( +void AutofillProfile::GetPossibleFieldTypes( const string16& text, FieldTypeSet* possible_types) const { FormGroupList info = info_list(); @@ -141,14 +141,14 @@ void AutoFillProfile::GetPossibleFieldTypes( (*it)->GetPossibleFieldTypes(text, possible_types); } -void AutoFillProfile::GetAvailableFieldTypes( +void AutofillProfile::GetAvailableFieldTypes( FieldTypeSet* available_types) const { FormGroupList info = info_list(); for (FormGroupList::const_iterator it = info.begin(); it != info.end(); ++it) (*it)->GetAvailableFieldTypes(available_types); } -string16 AutoFillProfile::GetFieldText(const AutofillType& type) const { +string16 AutofillProfile::GetFieldText(const AutofillType& type) const { AutofillType return_type( AutofillType::GetEquivalentFieldType(type.field_type())); @@ -160,7 +160,7 @@ string16 AutoFillProfile::GetFieldText(const AutofillType& type) const { return it->second->GetFieldText(return_type); } -void AutoFillProfile::FindInfoMatches( +void AutofillProfile::FindInfoMatches( const AutofillType& type, const string16& value, std::vector<string16>* matched_text) const { @@ -185,28 +185,28 @@ void AutoFillProfile::FindInfoMatches( } } -void AutoFillProfile::SetInfo(const AutofillType& type, const string16& value) { +void AutofillProfile::SetInfo(const AutofillType& type, const string16& value) { MutableFormGroupMap info = mutable_info_map(); MutableFormGroupMap::iterator it = info.find(type.group()); if (it != info.end()) it->second->SetInfo(type, CollapseWhitespace(value, false)); } -const string16 AutoFillProfile::Label() const { +const string16 AutofillProfile::Label() const { return label_; } -const std::string AutoFillProfile::CountryCode() const { +const std::string AutofillProfile::CountryCode() const { return address_.country_code(); } -void AutoFillProfile::SetCountryCode(const std::string& country_code) { +void AutofillProfile::SetCountryCode(const std::string& country_code) { address_.set_country_code(country_code); } // static -bool AutoFillProfile::AdjustInferredLabels( - std::vector<AutoFillProfile*>* profiles) { +bool AutofillProfile::AdjustInferredLabels( + std::vector<AutofillProfile*>* profiles) { const size_t kMinimalFieldsShown = 2; std::vector<string16> created_labels; @@ -225,8 +225,8 @@ bool AutoFillProfile::AdjustInferredLabels( } // static -void AutoFillProfile::CreateInferredLabels( - const std::vector<AutoFillProfile*>* profiles, +void AutofillProfile::CreateInferredLabels( + const std::vector<AutofillProfile*>* profiles, const std::vector<AutofillFieldType>* suggested_fields, AutofillFieldType excluded_field, size_t minimal_fields_shown, @@ -267,13 +267,13 @@ void AutoFillProfile::CreateInferredLabels( } } -bool AutoFillProfile::IsEmpty() const { +bool AutofillProfile::IsEmpty() const { FieldTypeSet types; GetAvailableFieldTypes(&types); return types.empty(); } -int AutoFillProfile::Compare(const AutoFillProfile& profile) const { +int AutofillProfile::Compare(const AutofillProfile& profile) const { // The following AutoFill field types are the only types we store in the WebDB // so far, so we're only concerned with matching these types in the profile. const AutofillFieldType types[] = { NAME_FIRST, @@ -300,22 +300,22 @@ int AutoFillProfile::Compare(const AutoFillProfile& profile) const { return 0; } -bool AutoFillProfile::operator==(const AutoFillProfile& profile) const { +bool AutofillProfile::operator==(const AutofillProfile& profile) const { return guid_ == profile.guid_ && Compare(profile) == 0; } -bool AutoFillProfile::operator!=(const AutoFillProfile& profile) const { +bool AutofillProfile::operator!=(const AutofillProfile& profile) const { return !operator==(profile); } -const string16 AutoFillProfile::PrimaryValue() const { +const string16 AutofillProfile::PrimaryValue() const { return GetFieldText(AutofillType(NAME_FULL)) + GetFieldText(AutofillType(ADDRESS_HOME_LINE1)) + GetFieldText(AutofillType(ADDRESS_HOME_LINE2)) + GetFieldText(AutofillType(EMAIL_ADDRESS)); } -string16 AutoFillProfile::ConstructInferredLabel( +string16 AutofillProfile::ConstructInferredLabel( const std::vector<AutofillFieldType>& included_fields, size_t num_fields_to_use) const { const string16 separator = @@ -346,8 +346,8 @@ string16 AutoFillProfile::ConstructInferredLabel( } // static -void AutoFillProfile::CreateDifferentiatingLabels( - const std::vector<AutoFillProfile*>& profiles, +void AutofillProfile::CreateDifferentiatingLabels( + const std::vector<AutofillProfile*>& profiles, const std::list<size_t>& indices, const std::vector<AutofillFieldType>& fields, size_t num_fields_to_include, @@ -363,7 +363,7 @@ void AutoFillProfile::CreateDifferentiatingLabels( for (std::list<size_t>::const_iterator it = indices.begin(); it != indices.end(); ++it) { - const AutoFillProfile* profile = profiles[*it]; + const AutofillProfile* profile = profiles[*it]; string16 field_text = profile->GetFieldText(AutofillType(*field)); // If this label is not already in the map, add it with frequency 0. @@ -384,7 +384,7 @@ void AutoFillProfile::CreateDifferentiatingLabels( // we only include fields that that have at last two distinct values. for (std::list<size_t>::const_iterator it = indices.begin(); it != indices.end(); ++it) { - const AutoFillProfile* profile = profiles[*it]; + const AutofillProfile* profile = profiles[*it]; std::vector<AutofillFieldType> label_fields; bool found_differentiating_field = false; @@ -422,7 +422,7 @@ void AutoFillProfile::CreateDifferentiatingLabels( } } -AutoFillProfile::FormGroupList AutoFillProfile::info_list() const { +AutofillProfile::FormGroupList AutofillProfile::info_list() const { FormGroupList v(6); v[0] = &name_; v[1] = &email_; @@ -433,7 +433,7 @@ AutoFillProfile::FormGroupList AutoFillProfile::info_list() const { return v; } -AutoFillProfile::FormGroupMap AutoFillProfile::info_map() const { +AutofillProfile::FormGroupMap AutofillProfile::info_map() const { FormGroupMap m; m[AutofillType::NAME] = &name_; m[AutofillType::EMAIL] = &email_; @@ -444,7 +444,7 @@ AutoFillProfile::FormGroupMap AutoFillProfile::info_map() const { return m; } -AutoFillProfile::MutableFormGroupMap AutoFillProfile::mutable_info_map() { +AutofillProfile::MutableFormGroupMap AutofillProfile::mutable_info_map() { FormGroupMap m_const = info_map(); MutableFormGroupMap m; for (FormGroupMap::const_iterator it = m_const.begin(); @@ -454,8 +454,8 @@ AutoFillProfile::MutableFormGroupMap AutoFillProfile::mutable_info_map() { return m; } -// So we can compare AutoFillProfiles with EXPECT_EQ(). -std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile) { +// So we can compare AutofillProfiles with EXPECT_EQ(). +std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) { return os << UTF16ToUTF8(profile.Label()) << " " diff --git a/chrome/browser/autofill/autofill_profile.h b/chrome/browser/autofill/autofill_profile.h index 3465c11..c3735c3 100644 --- a/chrome/browser/autofill/autofill_profile.h +++ b/chrome/browser/autofill/autofill_profile.h @@ -17,20 +17,20 @@ #include "chrome/browser/autofill/form_group.h" #include "chrome/browser/autofill/home_phone_number.h" -// A collection of FormGroups stored in a profile. AutoFillProfile also +// A collection of FormGroups stored in a profile. AutofillProfile also // implements the FormGroup interface so that owners of this object can request // form information from the profile, and the profile will delegate the request // to the requested form group type. -class AutoFillProfile : public FormGroup { +class AutofillProfile : public FormGroup { public: - explicit AutoFillProfile(const std::string& guid); + explicit AutofillProfile(const std::string& guid); // For use in STL containers. - AutoFillProfile(); - AutoFillProfile(const AutoFillProfile&); - virtual ~AutoFillProfile(); + AutofillProfile(); + AutofillProfile(const AutofillProfile&); + virtual ~AutofillProfile(); - AutoFillProfile& operator=(const AutoFillProfile& profile); + AutofillProfile& operator=(const AutofillProfile& profile); // FormGroup: virtual void GetPossibleFieldTypes(const string16& text, @@ -50,7 +50,7 @@ class AutoFillProfile : public FormGroup { // profiles. See AdjustInferredLabels() further down for more description. virtual const string16 Label() const; - // This guid is the primary identifier for |AutoFillProfile| objects. + // This guid is the primary identifier for |AutofillProfile| objects. const std::string guid() const { return guid_; } void set_guid(const std::string& guid) { guid_ = guid; } @@ -71,7 +71,7 @@ class AutoFillProfile : public FormGroup { // This function is useful if you want to adjust unique labels for all // profiles. For non permanent situations (selection of profile, when user // started typing in the field, for example) use CreateInferredLabels(). - static bool AdjustInferredLabels(std::vector<AutoFillProfile*>* profiles); + static bool AdjustInferredLabels(std::vector<AutofillProfile*>* profiles); // Creates inferred labels for |profiles|, according to the rules above and // stores them in |created_labels|. If |suggested_fields| is not NULL, the @@ -81,7 +81,7 @@ class AutoFillProfile : public FormGroup { // |UNKNOWN_TYPE| when |suggested_fields| is NULL. Each label includes at // least |minimal_fields_shown| fields, if possible. static void CreateInferredLabels( - const std::vector<AutoFillProfile*>* profiles, + const std::vector<AutofillProfile*>* profiles, const std::vector<AutofillFieldType>* suggested_fields, AutofillFieldType excluded_field, size_t minimal_fields_shown, @@ -95,11 +95,11 @@ class AutoFillProfile : public FormGroup { // culling duplicates. The ordering is based on collation order of the // textual contents of the fields. // GUIDs are not compared, only the values of the contents themselves. - int Compare(const AutoFillProfile& profile) const; + int Compare(const AutofillProfile& profile) const; // Equality operators compare GUIDs and the contents in the comparison. - bool operator==(const AutoFillProfile& profile) const; - virtual bool operator!=(const AutoFillProfile& profile) const; + bool operator==(const AutofillProfile& profile) const; + virtual bool operator!=(const AutofillProfile& profile) const; // Returns concatenation of full name and address line 1. This acts as the // basis of comparison for new values that are submitted through forms to @@ -124,7 +124,7 @@ class AutoFillProfile : public FormGroup { // the profiles, if possible; and also at least |num_fields_to_include| // fields, if possible. The label fields are drawn from |fields|. static void CreateDifferentiatingLabels( - const std::vector<AutoFillProfile*>& profiles, + const std::vector<AutofillProfile*>& profiles, const std::list<size_t>& indices, const std::vector<AutofillFieldType>& fields, size_t num_fields_to_include, @@ -151,7 +151,7 @@ class AutoFillProfile : public FormGroup { Address address_; }; -// So we can compare AutoFillProfiles with EXPECT_EQ(). -std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile); +// So we can compare AutofillProfiles with EXPECT_EQ(). +std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc index a84453b..37f78af 100644 --- a/chrome/browser/autofill/autofill_profile_unittest.cc +++ b/chrome/browser/autofill/autofill_profile_unittest.cc @@ -16,19 +16,19 @@ namespace { -bool UpdateProfileLabel(AutoFillProfile *profile) { - std::vector<AutoFillProfile*> profiles; +bool UpdateProfileLabel(AutofillProfile *profile) { + std::vector<AutofillProfile*> profiles; profiles.push_back(profile); - return AutoFillProfile::AdjustInferredLabels(&profiles); + return AutofillProfile::AdjustInferredLabels(&profiles); } } // namespace // Tests different possibilities for summary string generation. // Based on existence of first name, last name, and address line 1. -TEST(AutoFillProfileTest, PreviewSummaryString) { +TEST(AutofillProfileTest, PreviewSummaryString) { // Case 0/null: "" - AutoFillProfile profile0; + AutofillProfile profile0; // Empty profile - nothing to update. EXPECT_FALSE(UpdateProfileLabel(&profile0)); string16 summary0 = profile0.Label(); @@ -36,7 +36,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 0a/empty name and address, so the first two fields of the rest of the // data is used: "Hollywood, CA" - AutoFillProfile profile00; + AutofillProfile profile00; autofill_test::SetProfileInfo(&profile00, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -45,7 +45,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { EXPECT_EQ(ASCIIToUTF16("Hollywood, CA"), summary00); // Case 1: "<address>" - AutoFillProfile profile1; + AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -54,7 +54,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary1); // Case 2: "<lastname>" - AutoFillProfile profile2; + AutofillProfile profile2; autofill_test::SetProfileInfo(&profile2, "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -64,7 +64,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { EXPECT_EQ(ASCIIToUTF16("Hollywood, CA"), summary2); // Case 3: "<lastname>, <address>" - AutoFillProfile profile3; + AutofillProfile profile3; autofill_test::SetProfileInfo(&profile3, "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -73,7 +73,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary3); // Case 4: "<firstname>" - AutoFillProfile profile4; + AutofillProfile profile4; autofill_test::SetProfileInfo(&profile4, "Marion", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -82,7 +82,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, Hollywood"), summary4); // Case 5: "<firstname>, <address>" - AutoFillProfile profile5; + AutofillProfile profile5; autofill_test::SetProfileInfo(&profile5, "Marion", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -91,7 +91,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, 123 Zoo St."), summary5); // Case 6: "<firstname> <lastname>" - AutoFillProfile profile6; + AutofillProfile profile6; autofill_test::SetProfileInfo(&profile6, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -101,7 +101,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { summary6); // Case 7: "<firstname> <lastname>, <address>" - AutoFillProfile profile7; + AutofillProfile profile7; autofill_test::SetProfileInfo(&profile7, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -112,14 +112,14 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 7a: "<firstname> <lastname>, <address>" - same as #7, except for // e-mail. - AutoFillProfile profile7a; + AutofillProfile profile7a; autofill_test::SetProfileInfo(&profile7a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - std::vector<AutoFillProfile*> profiles; + std::vector<AutofillProfile*> profiles; profiles.push_back(&profile7); profiles.push_back(&profile7a); - EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); summary7 = profile7.Label(); string16 summary7a = profile7a.Label(); EXPECT_EQ(ASCIIToUTF16( @@ -128,9 +128,9 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { "Marion Mitchell Morrison, 123 Zoo St., marion@me.xyz"), summary7a); } -TEST(AutoFillProfileTest, AdjustInferredLabels) { - std::vector<AutoFillProfile*> profiles; - profiles.push_back(new AutoFillProfile); +TEST(AutofillProfileTest, AdjustInferredLabels) { + std::vector<AutofillProfile*> profiles; + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[0], "John", @@ -145,7 +145,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "US", "11111111111", "22222222222"); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[1], "Jane", @@ -161,15 +161,15 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "12345678910", "01987654321"); // As labels are empty they are adjusted the first time. - EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); // No need to adjust them anymore. - EXPECT_FALSE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_FALSE(AutofillProfile::AdjustInferredLabels(&profiles)); EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St."), profiles[0]->Label()); EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."), profiles[1]->Label()); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[2], "John", @@ -184,7 +184,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "US", "11111111111", "22222222222"); - EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); // Profile 0 and 2 inferred label now includes an e-mail. EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com"), @@ -197,7 +197,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { delete profiles[2]; profiles.pop_back(); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[2], "John", @@ -213,7 +213,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "11111111111", "33333333333"); // Fax is different - EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); // Profile 0 and 2 inferred label now includes a fax number. EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., fax:#22222222222"), @@ -223,7 +223,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., fax:#33333333333"), profiles[2]->Label()); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[3], "John", @@ -239,7 +239,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "44444444444", // Phone is different for some. "33333333333"); // Fax is different for some. - EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 11111111111," " fax:#22222222222"), @@ -254,7 +254,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 44444444444"), profiles[3]->Label()); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( profiles[4], "John", @@ -270,7 +270,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "44444444444", // Phone is different for some. "33333333333"); // Fax is different for some. - EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com," " 11111111111, fax:#22222222222"), @@ -288,15 +288,15 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@styx.com"), profiles[4]->Label()); - EXPECT_FALSE(AutoFillProfile::AdjustInferredLabels(&profiles)); + EXPECT_FALSE(AutofillProfile::AdjustInferredLabels(&profiles)); // Clean up. STLDeleteContainerPointers(profiles.begin(), profiles.end()); } -TEST(AutoFillProfileTest, CreateInferredLabels) { - std::vector<AutoFillProfile*> profiles; - profiles.push_back(new AutoFillProfile); +TEST(AutofillProfileTest, CreateInferredLabels) { + std::vector<AutofillProfile*> profiles; + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", @@ -310,7 +310,7 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { "US", "11111111111", "22222222222"); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "Jane", "", @@ -326,13 +326,13 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { "01987654321"); std::vector<string16> labels; // Two fields at least - no filter. - AutoFillProfile::CreateInferredLabels(&profiles, NULL, UNKNOWN_TYPE, 2, + AutofillProfile::CreateInferredLabels(&profiles, NULL, UNKNOWN_TYPE, 2, &labels); EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St."), labels[0]); EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."), labels[1]); // Three fields at least - no filter. - AutoFillProfile::CreateInferredLabels(&profiles, NULL, UNKNOWN_TYPE, 3, + AutofillProfile::CreateInferredLabels(&profiles, NULL, UNKNOWN_TYPE, 3, &labels); EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., Elysium"), labels[0]); @@ -345,20 +345,20 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { suggested_fields.push_back(ADDRESS_HOME_ZIP); // Two fields at least, from suggested fields - no filter. - AutoFillProfile::CreateInferredLabels(&profiles, &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, UNKNOWN_TYPE, 2, &labels); EXPECT_EQ(ASCIIToUTF16("Elysium, CA"), labels[0]); EXPECT_EQ(ASCIIToUTF16("Dis, CA"), labels[1]); // Three fields at least, from suggested fields - no filter. - AutoFillProfile::CreateInferredLabels(&profiles, &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, UNKNOWN_TYPE, 3, &labels); EXPECT_EQ(ASCIIToUTF16("Elysium, CA, 91111"), labels[0]); EXPECT_EQ(ASCIIToUTF16("Dis, CA, 91222"), labels[1]); // Three fields at least, from suggested fields - but filter reduces available // fields to two. - AutoFillProfile::CreateInferredLabels(&profiles, &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, ADDRESS_HOME_STATE, 3, &labels); EXPECT_EQ(ASCIIToUTF16("Elysium, 91111"), labels[0]); EXPECT_EQ(ASCIIToUTF16("Dis, 91222"), labels[1]); @@ -367,14 +367,14 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { // In our implementation we always display NAME_FULL for all NAME* fields... suggested_fields.push_back(NAME_MIDDLE); // One field at least, from suggested fields - no filter. - AutoFillProfile::CreateInferredLabels(&profiles, &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, UNKNOWN_TYPE, 1, &labels); EXPECT_EQ(ASCIIToUTF16("John Doe"), labels[0]); EXPECT_EQ(ASCIIToUTF16("Jane Doe"), labels[1]); // One field at least, from suggested fields - filter the same as suggested // field. - AutoFillProfile::CreateInferredLabels(&profiles, &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, NAME_MIDDLE, 1, &labels); EXPECT_EQ(string16(), labels[0]); EXPECT_EQ(string16(), labels[1]); @@ -385,7 +385,7 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { suggested_fields.push_back(UNKNOWN_TYPE); suggested_fields.push_back(NAME_FULL); suggested_fields.push_back(ADDRESS_HOME_LINE1); - AutoFillProfile::CreateInferredLabels(&profiles, &suggested_fields, NAME_FULL, + AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, NAME_FULL, 1, &labels); EXPECT_EQ(string16(ASCIIToUTF16("666 Erebus St.")), labels[0]); EXPECT_EQ(string16(ASCIIToUTF16("123 Letha Shore.")), labels[1]); @@ -396,13 +396,13 @@ TEST(AutoFillProfileTest, CreateInferredLabels) { // Test that we fall back to using the full name if there are no other // distinguishing fields, but only if it makes sense given the suggested fields. -TEST(AutoFillProfileTest, CreateInferredLabelsFallsBackToFullName) { - ScopedVector<AutoFillProfile> profiles; - profiles.push_back(new AutoFillProfile); +TEST(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { + ScopedVector<AutofillProfile> profiles; + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", "Doe", "doe@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "Johnny", "K", "Doe", "doe@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); @@ -414,7 +414,7 @@ TEST(AutoFillProfileTest, CreateInferredLabelsFallsBackToFullName) { suggested_fields.push_back(ADDRESS_HOME_LINE1); suggested_fields.push_back(EMAIL_ADDRESS); std::vector<string16> labels; - AutoFillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, NAME_LAST, 1, &labels); ASSERT_EQ(2U, labels.size()); EXPECT_EQ(ASCIIToUTF16("88 Nowhere Ave."), labels[0]); @@ -422,7 +422,7 @@ TEST(AutoFillProfileTest, CreateInferredLabelsFallsBackToFullName) { // Otherwise, we should. suggested_fields.push_back(NAME_FIRST); - AutoFillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, NAME_LAST, 1, &labels); ASSERT_EQ(2U, labels.size()); EXPECT_EQ(ASCIIToUTF16("88 Nowhere Ave., John Doe"), labels[0]); @@ -430,13 +430,13 @@ TEST(AutoFillProfileTest, CreateInferredLabelsFallsBackToFullName) { } // Test that we do not show duplicate fields in the labels. -TEST(AutoFillProfileTest, CreateInferredLabelsNoDuplicatedFields) { - ScopedVector<AutoFillProfile> profiles; - profiles.push_back(new AutoFillProfile); +TEST(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { + ScopedVector<AutofillProfile> profiles; + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", "Doe", "doe@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "John", "", "Doe", "dojo@example.com", "", "88 Nowhere Ave.", "", "", "", "", "", "", ""); @@ -448,7 +448,7 @@ TEST(AutoFillProfileTest, CreateInferredLabelsNoDuplicatedFields) { suggested_fields.push_back(ADDRESS_BILLING_LINE1); suggested_fields.push_back(EMAIL_ADDRESS); std::vector<string16> labels; - AutoFillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, + AutofillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, UNKNOWN_TYPE, 2, &labels); ASSERT_EQ(2U, labels.size()); EXPECT_EQ(ASCIIToUTF16("88 Nowhere Ave., doe@example.com"), labels[0]); @@ -456,23 +456,23 @@ TEST(AutoFillProfileTest, CreateInferredLabelsNoDuplicatedFields) { } // Make sure that empty fields are not treated as distinguishing fields. -TEST(AutoFillProfileTest, CreateInferredLabelsSkipsEmptyFields) { - ScopedVector<AutoFillProfile> profiles; - profiles.push_back(new AutoFillProfile); +TEST(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { + ScopedVector<AutofillProfile> profiles; + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], "John", "", "Doe", "doe@example.com", "Gogole", "", "", "", "", "", "", "", ""); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[1], "John", "", "Doe", "doe@example.com", "Ggoole", "", "", "", "", "", "", "", ""); - profiles.push_back(new AutoFillProfile); + profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[2], "John", "", "Doe", "john.doe@example.com", "Goolge", "", "", "", "", "", "", "", ""); std::vector<string16> labels; - AutoFillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 3, + AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 3, &labels); ASSERT_EQ(3U, labels.size()); EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Gogole"), labels[0]); @@ -483,7 +483,7 @@ TEST(AutoFillProfileTest, CreateInferredLabelsSkipsEmptyFields) { // distinguishing field. profiles[1]->SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("88 Nowhere Ave.")); - AutoFillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 1, + AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 1, &labels); ASSERT_EQ(3U, labels.size()); EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Gogole"), labels[0]); @@ -492,12 +492,12 @@ TEST(AutoFillProfileTest, CreateInferredLabelsSkipsEmptyFields) { EXPECT_EQ(ASCIIToUTF16("John Doe, john.doe@example.com"), labels[2]); } -TEST(AutoFillProfileTest, IsSubsetOf) { - scoped_ptr<AutoFillProfile> a, b; +TEST(AutofillProfileTest, IsSubsetOf) { + scoped_ptr<AutofillProfile> a, b; // |a| is a subset of |b|. - a.reset(new AutoFillProfile); - b.reset(new AutoFillProfile); + a.reset(new AutofillProfile); + b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -513,8 +513,8 @@ TEST(AutoFillProfileTest, IsSubsetOf) { EXPECT_TRUE(a->IsSubsetOf(*a)); // One field in |b| is different. - a.reset(new AutoFillProfile); - b.reset(new AutoFillProfile); + a.reset(new AutofillProfile); + b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -524,14 +524,14 @@ TEST(AutoFillProfileTest, IsSubsetOf) { EXPECT_FALSE(a->IsSubsetOf(*b)); } -TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { - scoped_ptr<AutoFillProfile> a, b; +TEST(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { + scoped_ptr<AutofillProfile> a, b; // Intersection of types contains the fields NAME_FIRST, NAME_LAST, // EMAIL_ADDRESS. The values of these field types are equal between the two // profiles. - a.reset(new AutoFillProfile); - b.reset(new AutoFillProfile); + a.reset(new AutofillProfile); + b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); @@ -542,8 +542,8 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { // Intersection of types contains the fields NAME_FIRST, NAME_LAST, // EMAIL_ADDRESS. The value of EMAIL_ADDRESS differs between the two profiles. - a.reset(new AutoFillProfile); - b.reset(new AutoFillProfile); + a.reset(new AutofillProfile); + b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); @@ -553,8 +553,8 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); // Intersection of types is empty. - a.reset(new AutoFillProfile); - b.reset(new AutoFillProfile); + a.reset(new AutofillProfile); + b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); @@ -564,21 +564,21 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); } -TEST(AutoFillProfileTest, MergeWith) { - scoped_ptr<AutoFillProfile> a, b; +TEST(AutofillProfileTest, MergeWith) { + scoped_ptr<AutofillProfile> a, b; // Merge |b| into |a|. - a.reset(new AutoFillProfile); - b.reset(new AutoFillProfile); + a.reset(new AutofillProfile); + b.reset(new AutofillProfile); autofill_test::SetProfileInfo(a.get(), "Jimmy", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); autofill_test::SetProfileInfo(b.get(), "James", NULL, "Madison", "constitutionalist@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); - AutoFillProfile expected_b(*b); + AutofillProfile expected_b(*b); a->MergeWith(*b); - AutoFillProfile expected_a; + AutofillProfile expected_a; autofill_test::SetProfileInfo(&expected_a, "Jimmy", NULL, "Madison", "constitutionalist@gmail.com", "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, "12134759123", @@ -587,8 +587,8 @@ TEST(AutoFillProfileTest, MergeWith) { EXPECT_EQ(0, expected_b.Compare(*b)); } -TEST(AutoFillProfileTest, AssignmentOperator){ - AutoFillProfile a, b; +TEST(AutofillProfileTest, AssignmentOperator){ + AutofillProfile a, b; // Result of assignment should be logically equal to the original profile. autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", @@ -603,20 +603,20 @@ TEST(AutoFillProfileTest, AssignmentOperator){ EXPECT_TRUE(a == b); } -TEST(AutoFillProfileTest, Copy) { - AutoFillProfile a; +TEST(AutofillProfileTest, Copy) { + AutofillProfile a; // Clone should be logically equal to the original. autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - AutoFillProfile b(a); + AutofillProfile b(a); EXPECT_TRUE(a == b); } -TEST(AutoFillProfileTest, Compare) { - AutoFillProfile a, b; +TEST(AutofillProfileTest, Compare) { + AutofillProfile a, b; // Empty profiles are the same. EXPECT_EQ(0, a.Compare(b)); @@ -635,8 +635,8 @@ TEST(AutoFillProfileTest, Compare) { EXPECT_LT(0, b.Compare(a)); } -TEST(AutoFillProfileTest, CountryCode) { - AutoFillProfile profile; +TEST(AutofillProfileTest, CountryCode) { + AutofillProfile profile; EXPECT_EQ(std::string(), profile.CountryCode()); profile.SetCountryCode("US"); diff --git a/chrome/browser/autofill/autofill_type.h b/chrome/browser/autofill/autofill_type.h index 9aef7b3..25b33e5 100644 --- a/chrome/browser/autofill/autofill_type.h +++ b/chrome/browser/autofill/autofill_type.h @@ -62,7 +62,7 @@ class AutofillType { FieldTypeSubGroup subgroup() const; // Maps |field_type| to a field type that can be directly stored in a profile - // (in the sense that it makes sense to call |AutoFillProfile::SetInfo()| with + // (in the sense that it makes sense to call |AutofillProfile::SetInfo()| with // the returned field type as the first parameter). static AutofillFieldType GetEquivalentFieldType(AutofillFieldType field_type); diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 392507a..287ce948 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -86,7 +86,7 @@ bool IsValidEmail(const string16& value) { // been met. An address submitted via a form must have at least these fields // filled. No verification of validity of the contents is preformed. This is // and existence check only. -bool IsMinimumAddress(const AutoFillProfile& profile) { +bool IsMinimumAddress(const AutofillProfile& profile) { return !profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)).empty() && !profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY)).empty() && !profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE)).empty() && @@ -128,10 +128,10 @@ void PersonalDataManager::OnWebDataServiceRequestDone( // If both requests have responded, then all personal data is loaded. if (pending_profiles_query_ == 0 && pending_creditcards_query_ == 0) { is_data_loaded_ = true; - std::vector<AutoFillProfile*> profile_pointers(web_profiles_.size()); + std::vector<AutofillProfile*> profile_pointers(web_profiles_.size()); std::copy(web_profiles_.begin(), web_profiles_.end(), profile_pointers.begin()); - AutoFillProfile::AdjustInferredLabels(&profile_pointers); + AutofillProfile::AdjustInferredLabels(&profile_pointers); FOR_EACH_OBSERVER(Observer, observers_, OnPersonalDataLoaded()); } } @@ -140,7 +140,7 @@ void PersonalDataManager::OnWebDataServiceRequestDone( // PersonalDataManager, // views::ButtonListener implementations void PersonalDataManager::OnAutoFillDialogApply( - std::vector<AutoFillProfile>* profiles, + std::vector<AutofillProfile>* profiles, std::vector<CreditCard>* credit_cards) { // |profiles| may be NULL. // |credit_cards| may be NULL. @@ -169,7 +169,7 @@ void PersonalDataManager::RemoveObserver( bool PersonalDataManager::ImportFormData( const std::vector<const FormStructure*>& form_structures, const CreditCard** imported_credit_card) { - scoped_ptr<AutoFillProfile> imported_profile(new AutoFillProfile); + scoped_ptr<AutofillProfile> imported_profile(new AutofillProfile); scoped_ptr<CreditCard> local_imported_credit_card(new CreditCard); // Parse the form and construct a profile based on the information that is @@ -300,24 +300,24 @@ bool PersonalDataManager::ImportFormData( return imported_profile.get() || *imported_credit_card; } -void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) { +void PersonalDataManager::SetProfiles(std::vector<AutofillProfile>* profiles) { if (profile_->IsOffTheRecord()) return; // Remove empty profiles from input. profiles->erase( std::remove_if(profiles->begin(), profiles->end(), - std::mem_fun_ref(&AutoFillProfile::IsEmpty)), + std::mem_fun_ref(&AutofillProfile::IsEmpty)), profiles->end()); // Ensure that profile labels are up to date. Currently, sync relies on // labels to identify a profile. // TODO(dhollowa): We need to deprecate labels and update the way sync // identifies profiles. - std::vector<AutoFillProfile*> profile_pointers(profiles->size()); + std::vector<AutofillProfile*> profile_pointers(profiles->size()); std::transform(profiles->begin(), profiles->end(), profile_pointers.begin(), - address_of<AutoFillProfile>); - AutoFillProfile::AdjustInferredLabels(&profile_pointers); + address_of<AutofillProfile>); + AutofillProfile::AdjustInferredLabels(&profile_pointers); WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); if (!wds) @@ -325,33 +325,33 @@ void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) { // Any profiles that are not in the new profile list should be removed from // the web database. - for (std::vector<AutoFillProfile*>::const_iterator iter = + for (std::vector<AutofillProfile*>::const_iterator iter = web_profiles_.begin(); iter != web_profiles_.end(); ++iter) { - if (!FindByGUID<AutoFillProfile>(*profiles, (*iter)->guid())) - wds->RemoveAutoFillProfile((*iter)->guid()); + if (!FindByGUID<AutofillProfile>(*profiles, (*iter)->guid())) + wds->RemoveAutofillProfile((*iter)->guid()); } // Update the web database with the existing profiles. - for (std::vector<AutoFillProfile>::iterator iter = profiles->begin(); + for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); iter != profiles->end(); ++iter) { - if (FindByGUID<AutoFillProfile>(web_profiles_, iter->guid())) - wds->UpdateAutoFillProfile(*iter); + if (FindByGUID<AutofillProfile>(web_profiles_, iter->guid())) + wds->UpdateAutofillProfile(*iter); } // Add the new profiles to the web database. Don't add a duplicate. - for (std::vector<AutoFillProfile>::iterator iter = profiles->begin(); + for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); iter != profiles->end(); ++iter) { - if (!FindByGUID<AutoFillProfile>(web_profiles_, iter->guid()) && + if (!FindByGUID<AutofillProfile>(web_profiles_, iter->guid()) && !FindByContents(web_profiles_, *iter)) - wds->AddAutoFillProfile(*iter); + wds->AddAutofillProfile(*iter); } // Copy in the new profiles. web_profiles_.reset(); - for (std::vector<AutoFillProfile>::iterator iter = profiles->begin(); + for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); iter != profiles->end(); ++iter) { - web_profiles_.push_back(new AutoFillProfile(*iter)); + web_profiles_.push_back(new AutofillProfile(*iter)); } // Read our writes to ensure consistency with the database. @@ -413,62 +413,62 @@ void PersonalDataManager::SetCreditCards( } // TODO(jhawkins): Refactor SetProfiles so this isn't so hacky. -void PersonalDataManager::AddProfile(const AutoFillProfile& profile) { +void PersonalDataManager::AddProfile(const AutofillProfile& profile) { // Don't save a web profile if the data in the profile is a subset of an // auxiliary profile. - for (std::vector<AutoFillProfile*>::const_iterator iter = + for (std::vector<AutofillProfile*>::const_iterator iter = auxiliary_profiles_.begin(); iter != auxiliary_profiles_.end(); ++iter) { if (profile.IsSubsetOf(**iter)) return; } - std::vector<AutoFillProfile> profiles; + std::vector<AutofillProfile> profiles; MergeProfile(profile, web_profiles_.get(), &profiles); SetProfiles(&profiles); } -void PersonalDataManager::UpdateProfile(const AutoFillProfile& profile) { +void PersonalDataManager::UpdateProfile(const AutofillProfile& profile) { WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); if (!wds) return; // Update the cached profile. - for (std::vector<AutoFillProfile*>::iterator iter = web_profiles_->begin(); + for (std::vector<AutofillProfile*>::iterator iter = web_profiles_->begin(); iter != web_profiles_->end(); ++iter) { if ((*iter)->guid() == profile.guid()) { delete *iter; - *iter = new AutoFillProfile(profile); + *iter = new AutofillProfile(profile); break; } } // Ensure that profile labels are up to date. - AutoFillProfile::AdjustInferredLabels(&web_profiles_.get()); + AutofillProfile::AdjustInferredLabels(&web_profiles_.get()); - wds->UpdateAutoFillProfile(profile); + wds->UpdateAutofillProfile(profile); FOR_EACH_OBSERVER(Observer, observers_, OnPersonalDataChanged()); } void PersonalDataManager::RemoveProfile(const std::string& guid) { // TODO(jhawkins): Refactor SetProfiles so this isn't so hacky. - std::vector<AutoFillProfile> profiles(web_profiles_.size()); + std::vector<AutofillProfile> profiles(web_profiles_.size()); std::transform(web_profiles_.begin(), web_profiles_.end(), profiles.begin(), - DereferenceFunctor<AutoFillProfile>()); + DereferenceFunctor<AutofillProfile>()); // Remove the profile that matches |guid|. profiles.erase( std::remove_if(profiles.begin(), profiles.end(), - FormGroupMatchesByGUIDFunctor<AutoFillProfile>(guid)), + FormGroupMatchesByGUIDFunctor<AutofillProfile>(guid)), profiles.end()); SetProfiles(&profiles); } -AutoFillProfile* PersonalDataManager::GetProfileByGUID( +AutofillProfile* PersonalDataManager::GetProfileByGUID( const std::string& guid) { - for (std::vector<AutoFillProfile*>::iterator iter = web_profiles_->begin(); + for (std::vector<AutofillProfile*>::iterator iter = web_profiles_->begin(); iter != web_profiles_->end(); ++iter) { if ((*iter)->guid() == guid) return *iter; @@ -539,8 +539,8 @@ void PersonalDataManager::GetPossibleFieldTypes(const string16& text, return; } - const std::vector<AutoFillProfile*>& profiles = this->profiles(); - for (std::vector<AutoFillProfile*>::const_iterator iter = profiles.begin(); + const std::vector<AutofillProfile*>& profiles = this->profiles(); + for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin(); iter != profiles.end(); ++iter) { const FormGroup* profile = *iter; if (!profile) { @@ -574,7 +574,7 @@ bool PersonalDataManager::IsDataLoaded() const { return is_data_loaded_; } -const std::vector<AutoFillProfile*>& PersonalDataManager::profiles() { +const std::vector<AutofillProfile*>& PersonalDataManager::profiles() { // |profile_| is NULL in AutofillManagerTest. bool auxiliary_profiles_enabled = profile_ ? profile_->GetPrefs()->GetBoolean( prefs::kAutoFillAuxiliaryProfilesEnabled) : false; @@ -596,7 +596,7 @@ const std::vector<AutoFillProfile*>& PersonalDataManager::profiles() { return profiles_; } -const std::vector<AutoFillProfile*>& PersonalDataManager::web_profiles() { +const std::vector<AutofillProfile*>& PersonalDataManager::web_profiles() { return web_profiles_.get(); } @@ -639,7 +639,7 @@ void PersonalDataManager::LoadProfiles() { CancelPendingQuery(&pending_profiles_query_); - pending_profiles_query_ = web_data_service->GetAutoFillProfiles(this); + pending_profiles_query_ = web_data_service->GetAutofillProfiles(this); } // Win and Linux implementations do nothing. Mac implementation fills in the @@ -669,11 +669,11 @@ void PersonalDataManager::ReceiveLoadedProfiles(WebDataService::Handle h, pending_profiles_query_ = 0; web_profiles_.reset(); - const WDResult<std::vector<AutoFillProfile*> >* r = - static_cast<const WDResult<std::vector<AutoFillProfile*> >*>(result); + const WDResult<std::vector<AutofillProfile*> >* r = + static_cast<const WDResult<std::vector<AutofillProfile*> >*>(result); - std::vector<AutoFillProfile*> profiles = r->GetValue(); - for (std::vector<AutoFillProfile*>::iterator iter = profiles.begin(); + std::vector<AutofillProfile*> profiles = r->GetValue(); + for (std::vector<AutofillProfile*>::iterator iter = profiles.begin(); iter != profiles.end(); ++iter) { web_profiles_.push_back(*iter); } @@ -712,7 +712,7 @@ void PersonalDataManager::CancelPendingQuery(WebDataService::Handle* handle) { } void PersonalDataManager::SaveImportedProfile( - const AutoFillProfile& imported_profile) { + const AutofillProfile& imported_profile) { if (profile_->IsOffTheRecord()) return; @@ -720,9 +720,9 @@ void PersonalDataManager::SaveImportedProfile( } bool PersonalDataManager::MergeProfile( - const AutoFillProfile& profile, - const std::vector<AutoFillProfile*>& existing_profiles, - std::vector<AutoFillProfile>* merged_profiles) { + const AutofillProfile& profile, + const std::vector<AutofillProfile*>& existing_profiles, + std::vector<AutofillProfile>* merged_profiles) { DCHECK(merged_profiles); merged_profiles->clear(); @@ -731,7 +731,7 @@ bool PersonalDataManager::MergeProfile( // First preference is to add missing values to an existing profile. // Only merge with the first match. - for (std::vector<AutoFillProfile*>::const_iterator iter = + for (std::vector<AutofillProfile*>::const_iterator iter = existing_profiles.begin(); iter != existing_profiles.end(); ++iter) { if (!merged) { @@ -753,7 +753,7 @@ bool PersonalDataManager::MergeProfile( // Again, only merge with the first match. if (!merged) { merged_profiles->clear(); - for (std::vector<AutoFillProfile*>::const_iterator iter = + for (std::vector<AutofillProfile*>::const_iterator iter = existing_profiles.begin(); iter != existing_profiles.end(); ++iter) { if (!merged) { diff --git a/chrome/browser/autofill/personal_data_manager.h b/chrome/browser/autofill/personal_data_manager.h index e7bfee6..6778093 100644 --- a/chrome/browser/autofill/personal_data_manager.h +++ b/chrome/browser/autofill/personal_data_manager.h @@ -55,7 +55,7 @@ class PersonalDataManager const WDTypedResult* result); // AutoFillDialogObserver implementation: - virtual void OnAutoFillDialogApply(std::vector<AutoFillProfile>* profiles, + virtual void OnAutoFillDialogApply(std::vector<AutofillProfile>* profiles, std::vector<CreditCard>* credit_cards); // Sets the listener to be notified of PersonalDataManager events. @@ -86,24 +86,24 @@ class PersonalDataManager // updates in |profiles| make it to the DB. This is why SetProfiles will // invoke Refresh after finishing, to ensure we get into a // consistent state. See Refresh for details. - void SetProfiles(std::vector<AutoFillProfile>* profiles); + void SetProfiles(std::vector<AutofillProfile>* profiles); // Sets |credit_cards_| to the contents of |credit_cards| and updates the web // database by adding, updating and removing credit cards. void SetCreditCards(std::vector<CreditCard>* credit_cards); // Adds |profile| to the web database. - void AddProfile(const AutoFillProfile& profile); + void AddProfile(const AutofillProfile& profile); // Updates |profile| which already exists in the web database. - void UpdateProfile(const AutoFillProfile& profile); + void UpdateProfile(const AutofillProfile& profile); // Removes the profile represented by |guid|. void RemoveProfile(const std::string& guid); // Returns the profile with the specified |guid|, or NULL if there is no // profile with the specified |guid|. - AutoFillProfile* GetProfileByGUID(const std::string& guid); + AutofillProfile* GetProfileByGUID(const std::string& guid); // Adds |credit_card| to the web database. void AddCreditCard(const CreditCard& credit_card); @@ -133,8 +133,8 @@ class PersonalDataManager // lifetime is until the web database is updated with new profile and credit // card information, respectively. |profiles()| returns both web and // auxiliary profiles. |web_profiles()| returns only web profiles. - const std::vector<AutoFillProfile*>& profiles(); - virtual const std::vector<AutoFillProfile*>& web_profiles(); + const std::vector<AutofillProfile*>& profiles(); + virtual const std::vector<AutofillProfile*>& web_profiles(); virtual const std::vector<CreditCard*>& credit_cards(); // Re-loads profiles and credit cards from the WebDatabase asynchronously. @@ -192,14 +192,14 @@ class PersonalDataManager void CancelPendingQuery(WebDataService::Handle* handle); // Saves |imported_profile| to the WebDB if it exists. - virtual void SaveImportedProfile(const AutoFillProfile& imported_profile); + virtual void SaveImportedProfile(const AutofillProfile& imported_profile); // Merges |profile| into one of the |existing_profiles| if possible; otherwise // appends |profile| to the end of that list. Fills |merged_profiles| with the // result. - bool MergeProfile(const AutoFillProfile& profile, - const std::vector<AutoFillProfile*>& existing_profiles, - std::vector<AutoFillProfile>* merged_profiles); + bool MergeProfile(const AutofillProfile& profile, + const std::vector<AutofillProfile*>& existing_profiles, + std::vector<AutofillProfile>* merged_profiles); // The first time this is called, logs an UMA metrics for the number of // profiles the user has. On subsequent calls, does nothing. @@ -216,14 +216,14 @@ class PersonalDataManager bool is_data_loaded_; // The loaded web profiles. - ScopedVector<AutoFillProfile> web_profiles_; + ScopedVector<AutofillProfile> web_profiles_; // Auxiliary profiles. - ScopedVector<AutoFillProfile> auxiliary_profiles_; + ScopedVector<AutofillProfile> auxiliary_profiles_; // Storage for combined web and auxiliary profiles. Contents are weak // references. Lifetime managed by |web_profiles_| and |auxiliary_profiles_|. - std::vector<AutoFillProfile*> profiles_; + std::vector<AutofillProfile*> profiles_; // The loaded credit cards. ScopedVector<CreditCard> credit_cards_; diff --git a/chrome/browser/autofill/personal_data_manager_mac.mm b/chrome/browser/autofill/personal_data_manager_mac.mm index 838ef6c..13d4f8e 100644 --- a/chrome/browser/autofill/personal_data_manager_mac.mm +++ b/chrome/browser/autofill/personal_data_manager_mac.mm @@ -30,7 +30,7 @@ class AuxiliaryProfilesImpl { // Constructor takes a reference to the |profiles| that will be filled in // by the subsequent call to |GetAddressBookMeCard()|. |profiles| may not // be NULL. - explicit AuxiliaryProfilesImpl(ScopedVector<AutoFillProfile>* profiles) + explicit AuxiliaryProfilesImpl(ScopedVector<AutofillProfile>* profiles) : profiles_(*profiles) { } virtual ~AuxiliaryProfilesImpl() {} @@ -41,25 +41,25 @@ class AuxiliaryProfilesImpl { private: void GetAddressBookNames(ABPerson* me, NSString* addressLabelRaw, - AutoFillProfile* profile); - void GetAddressBookAddresses(NSDictionary* address, AutoFillProfile* profile); + AutofillProfile* profile); + void GetAddressBookAddresses(NSDictionary* address, AutofillProfile* profile); void GetAddressBookEmail(ABPerson* me, NSString* addressLabelRaw, - AutoFillProfile* profile); + AutofillProfile* profile); void GetAddressBookPhoneNumbers(ABPerson* me, NSString* addressLabelRaw, - AutoFillProfile* profile); + AutofillProfile* profile); private: // A reference to the profiles this class populates. - ScopedVector<AutoFillProfile>& profiles_; + ScopedVector<AutofillProfile>& profiles_; DISALLOW_COPY_AND_ASSIGN(AuxiliaryProfilesImpl); }; // This method uses the |ABAddressBook| system service to fetch the "me" card // from the active user's address book. It looks for the user address -// information and translates it to the internal list of |AutoFillProfile| data +// information and translates it to the internal list of |AutofillProfile| data // structures. void AuxiliaryProfilesImpl::GetAddressBookMeCard() { profiles_.reset(); @@ -79,7 +79,7 @@ void AuxiliaryProfilesImpl::GetAddressBookMeCard() { const size_t kGUIDLength = 36U; std::string guid = base::SysNSStringToUTF8( [me valueForProperty:kABUIDProperty]).substr(0, kGUIDLength); - scoped_ptr<AutoFillProfile> profile(new AutoFillProfile(guid)); + scoped_ptr<AutofillProfile> profile(new AutofillProfile(guid)); DCHECK(guid::IsValidGUID(profile->guid())); // Fill in name and company information. @@ -105,7 +105,7 @@ void AuxiliaryProfilesImpl::GetAddressBookMeCard() { void AuxiliaryProfilesImpl::GetAddressBookNames( ABPerson* me, NSString* addressLabelRaw, - AutoFillProfile* profile) { + AutofillProfile* profile) { NSString* firstName = [me valueForProperty:kABFirstNameProperty]; NSString* middleName = [me valueForProperty:kABMiddleNameProperty]; NSString* lastName = [me valueForProperty:kABLastNameProperty]; @@ -130,7 +130,7 @@ void AuxiliaryProfilesImpl::GetAddressBookNames( // line 1: "c/o John Doe", line 2: "1122 Other Avenue, Apt #7". void AuxiliaryProfilesImpl::GetAddressBookAddresses( NSDictionary* address, - AutoFillProfile* profile) { + AutofillProfile* profile) { if (NSString* addressField = [address objectForKey:kABAddressStreetKey]) { // If there are newlines in the address, split into two lines. if ([addressField rangeOfCharacterFromSet: @@ -180,7 +180,7 @@ void AuxiliaryProfilesImpl::GetAddressBookAddresses( void AuxiliaryProfilesImpl::GetAddressBookEmail( ABPerson* me, NSString* addressLabelRaw, - AutoFillProfile* profile) { + AutofillProfile* profile) { ABMultiValue* emailAddresses = [me valueForProperty:kABEmailProperty]; NSString* emailAddress = nil; for (NSUInteger j = 0, emailCount = [emailAddresses count]; @@ -202,7 +202,7 @@ void AuxiliaryProfilesImpl::GetAddressBookEmail( void AuxiliaryProfilesImpl::GetAddressBookPhoneNumbers( ABPerson* me, NSString* addressLabelRaw, - AutoFillProfile* profile) { + AutofillProfile* profile) { string16 number; string16 city_code; string16 country_code; diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index 9eca163..2575239 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -89,19 +89,19 @@ class PersonalDataManagerTest : public testing::Test { // TODO(jhawkins): Test SetProfiles w/out a WebDataService in the profile. TEST_F(PersonalDataManagerTest, SetProfiles) { - AutoFillProfile profile0; + AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - AutoFillProfile profile1; + AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); - AutoFillProfile profile2; + AutofillProfile profile2; autofill_test::SetProfileInfo(&profile2, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", @@ -116,12 +116,12 @@ TEST_F(PersonalDataManagerTest, SetProfiles) { MessageLoop::current()->Run(); // Add two test profiles to the database. - std::vector<AutoFillProfile> update; + std::vector<AutofillProfile> update; update.push_back(profile0); update.push_back(profile1); personal_data_->SetProfiles(&update); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(2U, results1.size()); EXPECT_EQ(0, profile0.Compare(*results1.at(0))); EXPECT_EQ(0, profile1.Compare(*results1.at(1))); @@ -136,7 +136,7 @@ TEST_F(PersonalDataManagerTest, SetProfiles) { update.push_back(profile2); personal_data_->SetProfiles(&update); - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); ASSERT_EQ(2U, results2.size()); EXPECT_EQ(0, profile0.Compare(*results2.at(0))); EXPECT_EQ(0, profile2.Compare(*results2.at(1))); @@ -155,7 +155,7 @@ TEST_F(PersonalDataManagerTest, SetProfiles) { MessageLoop::current()->Run(); // Verify that we've loaded the profiles from the web database. - const std::vector<AutoFillProfile*>& results3 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results3 = personal_data_->profiles(); ASSERT_EQ(2U, results3.size()); EXPECT_EQ(0, profile0.Compare(*results3.at(0))); EXPECT_EQ(0, profile2.Compare(*results3.at(1))); @@ -230,13 +230,13 @@ TEST_F(PersonalDataManagerTest, SetCreditCards) { } TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) { - AutoFillProfile profile0; + AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - AutoFillProfile profile1; + AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", @@ -260,12 +260,12 @@ TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) { MessageLoop::current()->Run(); // Add two test profiles to the database. - std::vector<AutoFillProfile> update; + std::vector<AutofillProfile> update; update.push_back(profile0); update.push_back(profile1); personal_data_->SetProfiles(&update); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(2U, results1.size()); EXPECT_EQ(0, profile0.Compare(*results1.at(0))); EXPECT_EQ(0, profile1.Compare(*results1.at(1))); @@ -297,7 +297,7 @@ TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) { // Test care for 50047. Makes sure that unique_ids_ is populated correctly on // load. TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { - AutoFillProfile profile0; + AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, "y", "", "", "", "", "", "", "", "", "", "", "", ""); @@ -310,7 +310,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { MessageLoop::current()->Run(); // Add the profile0 to the db. - std::vector<AutoFillProfile> update; + std::vector<AutofillProfile> update; update.push_back(profile0); personal_data_->SetProfiles(&update); @@ -322,11 +322,11 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { MessageLoop::current()->Run(); // Verify that we've loaded the profiles from the web database. - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); ASSERT_EQ(1U, results2.size()); // Add a new profile. - AutoFillProfile profile1; + AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "y", "", "", "", "", "", "", "", "", "", "", "", ""); update.clear(); @@ -336,7 +336,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { // Make sure the two profiles have different ids (and neither equal to 0, // which is an invalid id). - const std::vector<AutoFillProfile*>& results3 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results3 = personal_data_->profiles(); ASSERT_EQ(2U, results3.size()); EXPECT_NE(results3[0]->guid(), results3[1]->guid()); EXPECT_TRUE(guid::IsValidGUID(results3[0]->guid())); @@ -344,7 +344,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { } TEST_F(PersonalDataManagerTest, SetEmptyProfile) { - AutoFillProfile profile0; + AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, "", "", "", "", "", "", "", "", "", "", "", "", ""); @@ -357,12 +357,12 @@ TEST_F(PersonalDataManagerTest, SetEmptyProfile) { MessageLoop::current()->Run(); // Add the empty profile to the database. - std::vector<AutoFillProfile> update; + std::vector<AutofillProfile> update; update.push_back(profile0); personal_data_->SetProfiles(&update); // Check the local store of profiles, not yet saved to the web database. - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(0U, results1.size()); // Reset the PersonalDataManager. This tests that the personal data was saved @@ -379,7 +379,7 @@ TEST_F(PersonalDataManagerTest, SetEmptyProfile) { MessageLoop::current()->Run(); // Verify that we've loaded the profiles from the web database. - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); ASSERT_EQ(0U, results2.size()); } @@ -423,13 +423,13 @@ TEST_F(PersonalDataManagerTest, SetEmptyCreditCard) { } TEST_F(PersonalDataManagerTest, Refresh) { - AutoFillProfile profile0; + AutofillProfile profile0; autofill_test::SetProfileInfo(&profile0, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - AutoFillProfile profile1; + AutofillProfile profile1; autofill_test::SetProfileInfo(&profile1, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", @@ -441,16 +441,16 @@ TEST_F(PersonalDataManagerTest, Refresh) { MessageLoop::current()->Run(); // Add the test profiles to the database. - std::vector<AutoFillProfile> update; + std::vector<AutofillProfile> update; update.push_back(profile0); update.push_back(profile1); personal_data_->SetProfiles(&update); // Labels depend on other profiles in the list - update labels manually. - std::vector<AutoFillProfile *> profile_pointers; + std::vector<AutofillProfile *> profile_pointers; profile_pointers.push_back(&profile0); profile_pointers.push_back(&profile1); - AutoFillProfile::AdjustInferredLabels(&profile_pointers); + AutofillProfile::AdjustInferredLabels(&profile_pointers); // Wait for the refresh. EXPECT_CALL(personal_data_observer_, @@ -458,12 +458,12 @@ TEST_F(PersonalDataManagerTest, Refresh) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(2U, results1.size()); EXPECT_EQ(profile0, *results1.at(0)); EXPECT_EQ(profile1, *results1.at(1)); - AutoFillProfile profile2; + AutofillProfile profile2; autofill_test::SetProfileInfo(&profile2, "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", @@ -471,11 +471,11 @@ TEST_F(PersonalDataManagerTest, Refresh) { // Adjust all labels. profile_pointers.push_back(&profile2); - AutoFillProfile::AdjustInferredLabels(&profile_pointers); + AutofillProfile::AdjustInferredLabels(&profile_pointers); WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); ASSERT_TRUE(wds); - wds->AddAutoFillProfile(profile2); + wds->AddAutofillProfile(profile2); personal_data_->Refresh(); @@ -485,14 +485,14 @@ TEST_F(PersonalDataManagerTest, Refresh) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); ASSERT_EQ(3U, results2.size()); EXPECT_EQ(profile0, *results2.at(0)); EXPECT_EQ(profile1, *results2.at(1)); EXPECT_EQ(profile2, *results2.at(2)); - wds->RemoveAutoFillProfile(profile1.guid()); - wds->RemoveAutoFillProfile(profile2.guid()); + wds->RemoveAutofillProfile(profile1.guid()); + wds->RemoveAutofillProfile(profile2.guid()); // Before telling the PDM to refresh, simulate an edit to one of the profiles // via a SetProfile update (this would happen if the AutoFill window was @@ -512,7 +512,7 @@ TEST_F(PersonalDataManagerTest, Refresh) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results3 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results3 = personal_data_->profiles(); ASSERT_EQ(1U, results3.size()); EXPECT_EQ(profile0, *results2.at(0)); } @@ -554,11 +554,11 @@ TEST_F(PersonalDataManagerTest, ImportFormData) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL, "San Francisco", "California", "94102", NULL, NULL, NULL); - const std::vector<AutoFillProfile*>& results = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results = personal_data_->profiles(); ASSERT_EQ(1U, results.size()); EXPECT_EQ(0, expected.Compare(*results[0])); } @@ -600,11 +600,11 @@ TEST_F(PersonalDataManagerTest, ImportFormDataBadEmail) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", NULL, NULL, "21 Laussat St", NULL, "San Francisco", "California", "94102", NULL, NULL, NULL); - const std::vector<AutoFillProfile*>& results = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results = personal_data_->profiles(); ASSERT_EQ(1U, results.size()); EXPECT_EQ(0, expected.Compare(*results[0])); } @@ -634,7 +634,7 @@ TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles(); + const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); ASSERT_EQ(0U, profiles.size()); const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); ASSERT_EQ(0U, credit_cards.size()); @@ -686,11 +686,11 @@ TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", NULL, NULL, "21 Laussat St", NULL, "San Francisco", "California", "94102", NULL, "6505550000", NULL); - const std::vector<AutoFillProfile*>& results = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results = personal_data_->profiles(); ASSERT_EQ(1U, results.size()); EXPECT_EQ(0, expected.Compare(*results[0])); } @@ -788,11 +788,11 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL, "San Francisco", "California", "94102", NULL, NULL, NULL); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -832,9 +832,9 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); - AutoFillProfile expected2; + AutofillProfile expected2; autofill_test::SetProfileInfo(&expected2, "John", NULL, "Adams", "second@gmail.com", NULL, "21 Laussat St", NULL, "San Francisco", "California", "94102", NULL, NULL, NULL); @@ -888,12 +888,12 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, "1600 Pennsylvania Avenue", "Suite A", "San Francisco", "California", "94102", NULL, "4445556666", NULL); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -944,9 +944,9 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); - AutoFillProfile expected2; + AutofillProfile expected2; autofill_test::SetProfileInfo(&expected2, "George", NULL, "Washington", "theprez@gmail.com", NULL, "1600 Pennsylvania Avenue", "Suite A", "San Francisco", "California", "94102", "USA", "1231231234", @@ -990,11 +990,11 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", NULL, NULL, "190 High Street", NULL, "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -1034,9 +1034,9 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); - AutoFillProfile expected2; + AutofillProfile expected2; autofill_test::SetProfileInfo(&expected2, "George", NULL, "Washington", "theprez@gmail.com", NULL, "190 High Street", NULL, "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); @@ -1085,11 +1085,11 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { MessageLoop::current()->Run(); - AutoFillProfile expected; + AutofillProfile expected; autofill_test::SetProfileInfo(&expected, "George", NULL, "Washington", "theprez@gmail.com", "Government", "190 High Street", NULL, "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); - const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results1 = personal_data_->profiles(); ASSERT_EQ(1U, results1.size()); EXPECT_EQ(0, expected.Compare(*results1[0])); @@ -1130,7 +1130,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& results2 = personal_data_->profiles(); + const std::vector<AutofillProfile*>& results2 = personal_data_->profiles(); // Expect no change. ASSERT_EQ(1U, results2.size()); @@ -1172,7 +1172,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithInsufficientAddress) { MessageLoop::current()->Run(); - const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles(); + const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); ASSERT_EQ(0U, profiles.size()); const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); ASSERT_EQ(0U, credit_cards.size()); diff --git a/chrome/browser/autofill/select_control_handler.cc b/chrome/browser/autofill/select_control_handler.cc index b92433a..dc44e72 100644 --- a/chrome/browser/autofill/select_control_handler.cc +++ b/chrome/browser/autofill/select_control_handler.cc @@ -159,8 +159,8 @@ bool FillStateSelectControl(const string16& value, bool FillCountrySelectControl(const FormGroup& form_group, webkit_glue::FormField* field) { - const AutoFillProfile& profile = - static_cast<const AutoFillProfile&>(form_group); + const AutofillProfile& profile = + static_cast<const AutofillProfile&>(form_group); std::string country_code = profile.CountryCode(); std::string app_locale = AutofillCountry::ApplicationLocale(); diff --git a/chrome/browser/autofill/select_control_handler_unittest.cc b/chrome/browser/autofill/select_control_handler_unittest.cc index a11859b..4e65ede 100644 --- a/chrome/browser/autofill/select_control_handler_unittest.cc +++ b/chrome/browser/autofill/select_control_handler_unittest.cc @@ -104,7 +104,7 @@ TEST(SelectControlHandlerTest, AddressCountryFull) { field.form_control_type = ASCIIToUTF16("select-one"); field.option_strings = options; - AutoFillProfile profile; + AutofillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("CA")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_COUNTRY), @@ -124,7 +124,7 @@ TEST(SelectControlHandlerTest, AddressCountryAbbrev) { field.form_control_type = ASCIIToUTF16("select-one"); field.option_strings = options; - AutoFillProfile profile; + AutofillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("Canada")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_COUNTRY), @@ -144,7 +144,7 @@ TEST(SelectControlHandlerTest, AddressStateFull) { field.form_control_type = ASCIIToUTF16("select-one"); field.option_strings = options; - AutoFillProfile profile; + AutofillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_STATE), @@ -164,7 +164,7 @@ TEST(SelectControlHandlerTest, AddressStateAbbrev) { field.form_control_type = ASCIIToUTF16("select-one"); field.option_strings = options; - AutoFillProfile profile; + AutofillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("California")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_STATE), diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 82639ad..859cd45 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -46,7 +46,7 @@ namespace IPC { class ChannelProxy; } -class AutoFillProfile; +class AutofillProfile; class AutomationAutocompleteEditTracker; class AutomationBrowserTracker; class AutomationExtensionTracker; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index d948dc0..8bf7fb7 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -2254,10 +2254,10 @@ void TestingAutomationProvider::SendJSONRequest(int handle, browser_handler_map["GetTranslateInfo"] = &TestingAutomationProvider::GetTranslateInfo; - browser_handler_map["GetAutoFillProfile"] = - &TestingAutomationProvider::GetAutoFillProfile; - browser_handler_map["FillAutoFillProfile"] = - &TestingAutomationProvider::FillAutoFillProfile; + browser_handler_map["GetAutofillProfile"] = + &TestingAutomationProvider::GetAutofillProfile; + browser_handler_map["FillAutofillProfile"] = + &TestingAutomationProvider::FillAutofillProfile; browser_handler_map["GetActiveNotifications"] = &TestingAutomationProvider::GetActiveNotifications; @@ -3936,15 +3936,15 @@ void TestingAutomationProvider::UninstallExtensionById( } // Sample json input: -// { "command": "GetAutoFillProfile" } -// Refer to GetAutoFillProfile() in chrome/test/pyautolib/pyauto.py for sample +// { "command": "GetAutofillProfile" } +// Refer to GetAutofillProfile() in chrome/test/pyautolib/pyauto.py for sample // json output. -void TestingAutomationProvider::GetAutoFillProfile( +void TestingAutomationProvider::GetAutofillProfile( Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); - // Get the AutoFillProfiles currently in the database. + // Get the AutofillProfiles currently in the database. int tab_index = 0; if (!args->GetInteger("tab_index", &tab_index)) { reply.SendError("Invalid or missing tab_index integer value."); @@ -3956,10 +3956,10 @@ void TestingAutomationProvider::GetAutoFillProfile( PersonalDataManager* pdm = tab_contents->profile()->GetOriginalProfile() ->GetPersonalDataManager(); if (pdm) { - std::vector<AutoFillProfile*> autofill_profiles = pdm->profiles(); + std::vector<AutofillProfile*> autofill_profiles = pdm->profiles(); std::vector<CreditCard*> credit_cards = pdm->credit_cards(); - ListValue* profiles = GetListFromAutoFillProfiles(autofill_profiles); + ListValue* profiles = GetListFromAutofillProfiles(autofill_profiles); ListValue* cards = GetListFromCreditCards(credit_cards); scoped_ptr<DictionaryValue> return_value(new DictionaryValue); @@ -3977,10 +3977,10 @@ void TestingAutomationProvider::GetAutoFillProfile( } } -// Refer to FillAutoFillProfile() in chrome/test/pyautolib/pyauto.py for sample +// Refer to FillAutofillProfile() in chrome/test/pyautolib/pyauto.py for sample // json input. // Sample json output: {} -void TestingAutomationProvider::FillAutoFillProfile( +void TestingAutomationProvider::FillAutofillProfile( Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { @@ -3994,11 +3994,11 @@ void TestingAutomationProvider::FillAutoFillProfile( std::string error_mesg; - std::vector<AutoFillProfile> autofill_profiles; + std::vector<AutofillProfile> autofill_profiles; std::vector<CreditCard> credit_cards; - // Create an AutoFillProfile for each of the dictionary profiles. + // Create an AutofillProfile for each of the dictionary profiles. if (profiles) { - autofill_profiles = GetAutoFillProfilesFromList(*profiles, &error_mesg); + autofill_profiles = GetAutofillProfilesFromList(*profiles, &error_mesg); } // Create a CreditCard for each of the dictionary values. if (cards) { @@ -4009,7 +4009,7 @@ void TestingAutomationProvider::FillAutoFillProfile( return; } - // Save the AutoFillProfiles. + // Save the AutofillProfiles. int tab_index = 0; if (!args->GetInteger("tab_index", &tab_index)) { reply.SendError("Invalid or missing tab_index integer"); @@ -4252,18 +4252,18 @@ void TestingAutomationProvider::DisableSyncForDatatypes( } /* static */ -ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles( - const std::vector<AutoFillProfile*>& autofill_profiles) { +ListValue* TestingAutomationProvider::GetListFromAutofillProfiles( + const std::vector<AutofillProfile*>& autofill_profiles) { ListValue* profiles = new ListValue; std::map<AutofillFieldType, std::string> autofill_type_to_string = GetAutofillFieldToStringMap(); - // For each AutoFillProfile, transform it to a dictionary object to return. - for (std::vector<AutoFillProfile*>::const_iterator it = + // For each AutofillProfile, transform it to a dictionary object to return. + for (std::vector<AutofillProfile*>::const_iterator it = autofill_profiles.begin(); it != autofill_profiles.end(); ++it) { - AutoFillProfile* profile = *it; + AutofillProfile* profile = *it; DictionaryValue* profile_info = new DictionaryValue; // For each of the types, if it has a value, add it to the dictionary. for (std::map<AutofillFieldType, std::string>::iterator @@ -4287,7 +4287,7 @@ ListValue* TestingAutomationProvider::GetListFromCreditCards( std::map<AutofillFieldType, std::string> credit_card_type_to_string = GetCreditCardFieldToStringMap(); - // For each AutoFillProfile, transform it to a dictionary object to return. + // For each AutofillProfile, transform it to a dictionary object to return. for (std::vector<CreditCard*>::const_iterator it = credit_cards.begin(); it != credit_cards.end(); ++it) { @@ -4309,10 +4309,10 @@ ListValue* TestingAutomationProvider::GetListFromCreditCards( } /* static */ -std::vector<AutoFillProfile> -TestingAutomationProvider::GetAutoFillProfilesFromList( +std::vector<AutofillProfile> +TestingAutomationProvider::GetAutofillProfilesFromList( const ListValue& profiles, std::string* error_message) { - std::vector<AutoFillProfile> autofill_profiles; + std::vector<AutofillProfile> autofill_profiles; DictionaryValue* profile_info = NULL; string16 current_value; @@ -4322,7 +4322,7 @@ TestingAutomationProvider::GetAutoFillProfilesFromList( int num_profiles = profiles.GetSize(); for (int i = 0; i < num_profiles; i++) { profiles.GetDictionary(i, &profile_info); - AutoFillProfile profile; + AutofillProfile profile; // Loop through the possible profile types and add those provided. for (std::map<AutofillFieldType, std::string>::iterator type_it = autofill_type_to_string.begin(); diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index b6b369a..0668dcf 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -633,13 +633,13 @@ class TestingAutomationProvider : public AutomationProvider, // Get the profiles that are currently saved to the DB. // Uses the JSON interface for input/output. - void GetAutoFillProfile(Browser* browser, + void GetAutofillProfile(Browser* browser, DictionaryValue* args, IPC::Message* reply_message); - // Fill in an AutoFillProfile with the given profile information. + // Fill in an AutofillProfile with the given profile information. // Uses the JSON interface for input/output. - void FillAutoFillProfile(Browser* browser, + void FillAutofillProfile(Browser* browser, DictionaryValue* args, IPC::Message* reply_message); @@ -678,7 +678,7 @@ class TestingAutomationProvider : public AutomationProvider, // Args: // profiles/cards: the ListValue of profiles/credit cards to translate. // error_message: a pointer to the return string in case of error. - static std::vector<AutoFillProfile> GetAutoFillProfilesFromList( + static std::vector<AutofillProfile> GetAutofillProfilesFromList( const ListValue& profiles, std::string* error_message); static std::vector<CreditCard> GetCreditCardsFromList( const ListValue& cards, std::string* error_message); @@ -686,8 +686,8 @@ class TestingAutomationProvider : public AutomationProvider, // The opposite of the above: translates from the internal data structure // for profiles and credit cards to a ListValue of DictionaryValues. The // caller owns the returned object. - static ListValue* GetListFromAutoFillProfiles( - const std::vector<AutoFillProfile*>& autofill_profiles); + static ListValue* GetListFromAutofillProfiles( + const std::vector<AutofillProfile*>& autofill_profiles); static ListValue* GetListFromCreditCards( const std::vector<CreditCard*>& credit_cards); diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc index 5385e92..f21d61e 100644 --- a/chrome/browser/browsing_data_remover.cc +++ b/chrome/browser/browsing_data_remover.cc @@ -228,7 +228,7 @@ void BrowsingDataRemover::Remove(int remove_mask) { if (web_data_service) { web_data_service->RemoveFormElementsAddedBetween(delete_begin_, delete_end_); - web_data_service->RemoveAutoFillProfilesAndCreditCardsModifiedBetween( + web_data_service->RemoveAutofillProfilesAndCreditCardsModifiedBetween( delete_begin_, delete_end_); PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); if (data_manager) { diff --git a/chrome/browser/sync/glue/autofill_change_processor.cc b/chrome/browser/sync/glue/autofill_change_processor.cc index 15d7000..0f2f270 100644 --- a/chrome/browser/sync/glue/autofill_change_processor.cc +++ b/chrome/browser/sync/glue/autofill_change_processor.cc @@ -344,11 +344,11 @@ void AutofillChangeProcessor::ApplySyncAutofillProfileChange( DCHECK(false) << "Guid generated is invalid " << guid; return; } - scoped_ptr<AutoFillProfile> p(new AutoFillProfile); + scoped_ptr<AutofillProfile> p(new AutofillProfile); p->set_guid(guid); AutofillModelAssociator::FillProfileWithServerData(p.get(), profile); - if (!web_database_->AddAutoFillProfile(*p.get())) { + if (!web_database_->AddAutofillProfile(*p.get())) { NOTREACHED() << "Couldn't add autofill profile: " << guid; return; } @@ -364,16 +364,16 @@ void AutofillChangeProcessor::ApplySyncAutofillProfileChange( "model association has not happened"); return; } - AutoFillProfile *temp_ptr; - if (!web_database_->GetAutoFillProfile(*guid, &temp_ptr)) { + AutofillProfile *temp_ptr; + if (!web_database_->GetAutofillProfile(*guid, &temp_ptr)) { LOG(ERROR) << "Autofill profile not found for " << *guid; return; } - scoped_ptr<AutoFillProfile> p(temp_ptr); + scoped_ptr<AutofillProfile> p(temp_ptr); AutofillModelAssociator::FillProfileWithServerData(p.get(), profile); - if (!web_database_->UpdateAutoFillProfile(*(p.get()))) { + if (!web_database_->UpdateAutofillProfile(*(p.get()))) { LOG(ERROR) << "Couldn't update autofill profile: " << guid; return; } @@ -393,7 +393,7 @@ void AutofillChangeProcessor::ApplySyncAutofillProfileDelete( return; } - if (!web_database_->RemoveAutoFillProfile(*guid)) { + if (!web_database_->RemoveAutofillProfile(*guid)) { LOG(ERROR) << "Could not remove the profile"; return; } diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index 5ecefc6..bd96ea5 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -35,8 +35,8 @@ struct AutofillModelAssociator::DataBundle { std::set<AutofillKey> current_entries; std::vector<AutofillEntry> new_entries; std::set<string16> current_profiles; - std::vector<AutoFillProfile*> updated_profiles; - std::vector<AutoFillProfile*> new_profiles; // We own these pointers. + std::vector<AutofillProfile*> updated_profiles; + std::vector<AutofillProfile*> new_profiles; // We own these pointers. ~DataBundle() { STLDeleteElements(&new_profiles); } }; @@ -118,7 +118,7 @@ bool AutofillModelAssociator::TraverseAndAssociateChromeAutofillEntries( bool AutofillModelAssociator::LoadAutofillData( std::vector<AutofillEntry>* entries, - std::vector<AutoFillProfile*>* profiles) { + std::vector<AutofillProfile*>* profiles) { if (IsAbortPending()) return false; if (!web_database_->GetAllAutofillEntries(entries)) @@ -126,7 +126,7 @@ bool AutofillModelAssociator::LoadAutofillData( if (IsAbortPending()) return false; - if (!web_database_->GetAutoFillProfiles(profiles)) + if (!web_database_->GetAutofillProfiles(profiles)) return false; return true; @@ -142,7 +142,7 @@ bool AutofillModelAssociator::AssociateModels() { // TODO(zork): Attempt to load the model association from storage. std::vector<AutofillEntry> entries; - ScopedVector<AutoFillProfile> profiles; + ScopedVector<AutofillProfile> profiles; if (!LoadAutofillData(&entries, &profiles.get())) { LOG(ERROR) << "Could not get the autofill data from WebDatabase."; @@ -213,14 +213,14 @@ bool AutofillModelAssociator::SaveChangesToWebData(const DataBundle& bundle) { for (size_t i = 0; i < bundle.new_profiles.size(); i++) { if (IsAbortPending()) return false; - if (!web_database_->AddAutoFillProfile(*bundle.new_profiles[i])) + if (!web_database_->AddAutofillProfile(*bundle.new_profiles[i])) return false; } for (size_t i = 0; i < bundle.updated_profiles.size(); i++) { if (IsAbortPending()) return false; - if (!web_database_->UpdateAutoFillProfile(*bundle.updated_profiles[i])) + if (!web_database_->UpdateAutofillProfile(*bundle.updated_profiles[i])) return false; } return true; @@ -230,7 +230,7 @@ bool AutofillModelAssociator::TraverseAndAssociateAllSyncNodes( sync_api::WriteTransaction* write_trans, const sync_api::ReadNode& autofill_root, DataBundle* bundle, - const std::vector<AutoFillProfile*>& all_profiles_from_db) { + const std::vector<AutofillProfile*>& all_profiles_from_db) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); bool autofill_profile_not_migrated = HasNotMigratedYet(write_trans); @@ -239,9 +239,9 @@ bool AutofillModelAssociator::TraverseAndAssociateAllSyncNodes( VLOG(2) << "[AUTOFILL MIGRATION]" << "Printing profiles from web db"; - for (std::vector<AutoFillProfile*>::const_iterator ix = + for (std::vector<AutofillProfile*>::const_iterator ix = all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) { - AutoFillProfile* p = *ix; + AutofillProfile* p = *ix; VLOG(2) << "[AUTOFILL MIGRATION] " << p->GetFieldText(AutofillType(NAME_FIRST)) << p->GetFieldText(AutofillType(NAME_LAST)); @@ -288,8 +288,8 @@ bool AutofillModelAssociator::TraverseAndAssociateAllSyncNodes( // Define the functor to be used as the predicate in find_if call. struct CompareProfiles - : public std::binary_function<AutoFillProfile*, AutoFillProfile*, bool> { - bool operator() (AutoFillProfile* p1, AutoFillProfile* p2) const { + : public std::binary_function<AutofillProfile*, AutofillProfile*, bool> { + bool operator() (AutofillProfile* p1, AutofillProfile* p2) const { if (p1->Compare(*p2) == 0) return true; else @@ -297,11 +297,11 @@ struct CompareProfiles } }; -AutoFillProfile* AutofillModelAssociator::FindCorrespondingNodeFromWebDB( +AutofillProfile* AutofillModelAssociator::FindCorrespondingNodeFromWebDB( const sync_pb::AutofillProfileSpecifics& profile, - const std::vector<AutoFillProfile*>& all_profiles_from_db) { + const std::vector<AutofillProfile*>& all_profiles_from_db) { static std::string guid(guid::GenerateGUID()); - AutoFillProfile p; + AutofillProfile p; p.set_guid(guid); if (!FillProfileWithServerData(&p, profile)) { // Not a big deal. We encountered an error. Just say this profile does not @@ -311,7 +311,7 @@ AutoFillProfile* AutofillModelAssociator::FindCorrespondingNodeFromWebDB( } // Now instantiate the functor and call find_if. - std::vector<AutoFillProfile*>::const_iterator ix = + std::vector<AutofillProfile*>::const_iterator ix = std::find_if(all_profiles_from_db.begin(), all_profiles_from_db.end(), std::bind2nd(CompareProfiles(), &p)); @@ -342,11 +342,11 @@ void AutofillModelAssociator::AddNativeProfileIfNeeded( const sync_pb::AutofillProfileSpecifics& profile, DataBundle* bundle, const sync_api::ReadNode& node, - const std::vector<AutoFillProfile*>& all_profiles_from_db) { + const std::vector<AutofillProfile*>& all_profiles_from_db) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - AutoFillProfile* profile_in_web_db = FindCorrespondingNodeFromWebDB( + AutofillProfile* profile_in_web_db = FindCorrespondingNodeFromWebDB( profile, all_profiles_from_db); if (profile_in_web_db != NULL) { @@ -365,7 +365,7 @@ void AutofillModelAssociator::AddNativeProfileIfNeeded( return; } Associate(&guid, node.GetId()); - AutoFillProfile* p = new AutoFillProfile(guid); + AutofillProfile* p = new AutofillProfile(guid); FillProfileWithServerData(p, profile); bundle->new_profiles.push_back(p); } @@ -506,10 +506,10 @@ bool MergeField(FormGroup* f, AutofillFieldType t, // static bool AutofillModelAssociator::FillProfileWithServerData( - AutoFillProfile* merge_into, + AutofillProfile* merge_into, const sync_pb::AutofillProfileSpecifics& specifics) { bool diff = false; - AutoFillProfile* p = merge_into; + AutofillProfile* p = merge_into; const sync_pb::AutofillProfileSpecifics& s(specifics); diff = MergeField(p, NAME_FIRST, s.name_first()) || diff; diff = MergeField(p, NAME_LAST, s.name_last()) || diff; diff --git a/chrome/browser/sync/glue/autofill_model_associator.h b/chrome/browser/sync/glue/autofill_model_associator.h index 09cfcdc..367ae13 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.h +++ b/chrome/browser/sync/glue/autofill_model_associator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -20,7 +20,7 @@ #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" #include "chrome/browser/webdata/autofill_entry.h" -class AutoFillProfile; +class AutofillProfile; class ProfileSyncService; class WebDatabase; @@ -93,7 +93,7 @@ class AutofillModelAssociator const std::vector<base::Time>& timestamps, std::vector<base::Time>* new_timestamps); static bool FillProfileWithServerData( - AutoFillProfile* merge_into, + AutofillProfile* merge_into, const sync_pb::AutofillProfileSpecifics& specifics); // TODO(georgey) : add the same processing for CC info (already in protocol @@ -108,9 +108,9 @@ class AutofillModelAssociator protected: // Given a profile from sync db it tries to match the profile against // one in web db. it ignores the guid and compares the actual data. - AutoFillProfile* FindCorrespondingNodeFromWebDB( + AutofillProfile* FindCorrespondingNodeFromWebDB( const sync_pb::AutofillProfileSpecifics& profile, - const std::vector<AutoFillProfile*>& all_profiles_from_db); + const std::vector<AutofillProfile*>& all_profiles_from_db); private: typedef std::map<std::string, int64> AutofillToSyncIdMap; @@ -122,7 +122,7 @@ class AutofillModelAssociator // Helper to query WebDatabase for the current autofill state. bool LoadAutofillData(std::vector<AutofillEntry>* entries, - std::vector<AutoFillProfile*>* profiles); + std::vector<AutofillProfile*>* profiles); // We split up model association first by autofill sub-type (entries, and // profiles. There is a Traverse* method for each of these. @@ -132,12 +132,12 @@ class AutofillModelAssociator const std::vector<AutofillEntry>& all_entries_from_db, std::set<AutofillKey>* current_entries, std::vector<AutofillEntry>* new_entries); - bool TraverseAndAssociateChromeAutoFillProfiles( + bool TraverseAndAssociateChromeAutofillProfiles( sync_api::WriteTransaction* write_trans, const sync_api::ReadNode& autofill_root, - const std::vector<AutoFillProfile*>& all_profiles_from_db, + const std::vector<AutofillProfile*>& all_profiles_from_db, std::set<string16>* current_profiles, - std::vector<AutoFillProfile*>* updated_profiles); + std::vector<AutofillProfile*>* updated_profiles); // Once the above traversals are complete, we traverse the sync model to // associate all remaining nodes. @@ -145,7 +145,7 @@ class AutofillModelAssociator sync_api::WriteTransaction* write_trans, const sync_api::ReadNode& autofill_root, DataBundle* bundle, - const std::vector<AutoFillProfile*>& all_profiles_from_db); + const std::vector<AutofillProfile*>& all_profiles_from_db); // Helper to persist any changes that occured during model association to // the WebDatabase. @@ -157,13 +157,13 @@ class AutofillModelAssociator DataBundle* bundle, const sync_api::ReadNode& node); - // Helper to insert an AutoFillProfile into the WebDatabase (e.g. in response + // Helper to insert an AutofillProfile into the WebDatabase (e.g. in response // to encountering a sync node that doesn't exist yet locally). void AddNativeProfileIfNeeded( const sync_pb::AutofillProfileSpecifics& profile, DataBundle* bundle, const sync_api::ReadNode& node, - const std::vector<AutoFillProfile*>& all_profiles_from_db); + const std::vector<AutofillProfile*>& all_profiles_from_db); // Called at various points in model association to determine if the // user requested an abort. diff --git a/chrome/browser/sync/glue/autofill_profile_change_processor.cc b/chrome/browser/sync/glue/autofill_profile_change_processor.cc index 727c1d4..76b414b 100644 --- a/chrome/browser/sync/glue/autofill_profile_change_processor.cc +++ b/chrome/browser/sync/glue/autofill_profile_change_processor.cc @@ -179,7 +179,7 @@ void AutofillProfileChangeProcessor::CommitChangesFromSyncModel() { for (unsigned int i = 0;i < autofill_changes_.size(); ++i) { if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == autofill_changes_[i].action_) { - if (!web_database_->RemoveAutoFillProfile( + if (!web_database_->RemoveAutofillProfile( autofill_changes_[i].profile_specifics_.guid())) { LOG(ERROR) << "could not delete the profile " << autofill_changes_[i].profile_specifics_.guid(); @@ -218,10 +218,10 @@ void AutofillProfileChangeProcessor::ApplyAutofillProfileChange( profile_specifics.guid(); return; } - AutoFillProfile p(profile_specifics.guid()); + AutofillProfile p(profile_specifics.guid()); AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p, profile_specifics); - if (!web_database_->AddAutoFillProfile(p)) { + if (!web_database_->AddAutofillProfile(p)) { LOG(ERROR) << "could not add autofill profile for guid " << p.guid(); break; } @@ -232,18 +232,18 @@ void AutofillProfileChangeProcessor::ApplyAutofillProfileChange( break; } case sync_api::SyncManager::ChangeRecord::ACTION_UPDATE: { - AutoFillProfile *p; - if (!web_database_->GetAutoFillProfile(profile_specifics.guid(), &p)) { + AutofillProfile *p; + if (!web_database_->GetAutofillProfile(profile_specifics.guid(), &p)) { LOG(ERROR) << "Could not find the autofill profile to update for " << profile_specifics.guid(); break; } - scoped_ptr<AutoFillProfile> autofill_pointer(p); + scoped_ptr<AutofillProfile> autofill_pointer(p); AutofillProfileModelAssociator::OverwriteProfileWithServerData( autofill_pointer.get(), profile_specifics); - if (!web_database_->UpdateAutoFillProfile(*(autofill_pointer.get()))) { + if (!web_database_->UpdateAutofillProfile(*(autofill_pointer.get()))) { LOG(ERROR) << "Could not update autofill profile for " << profile_specifics.guid(); break; @@ -278,7 +278,7 @@ void AutofillProfileChangeProcessor::RemoveSyncNode(const std::string& guid, void AutofillProfileChangeProcessor::AddAutofillProfileSyncNode( sync_api::WriteTransaction* trans, sync_api::BaseNode& autofill_profile_root, - const AutoFillProfile& profile) { + const AutofillProfile& profile) { std::string guid = profile.guid(); @@ -315,7 +315,7 @@ void AutofillProfileChangeProcessor::StopObserving() { } void AutofillProfileChangeProcessor::WriteAutofillProfile( - const AutoFillProfile& profile, + const AutofillProfile& profile, sync_api::WriteNode* node) { sync_pb::AutofillProfileSpecifics specifics; diff --git a/chrome/browser/sync/glue/autofill_profile_change_processor.h b/chrome/browser/sync/glue/autofill_profile_change_processor.h index a3de74a..2abe488 100644 --- a/chrome/browser/sync/glue/autofill_profile_change_processor.h +++ b/chrome/browser/sync/glue/autofill_profile_change_processor.h @@ -48,7 +48,7 @@ class AutofillProfileChangeProcessor : public ChangeProcessor, const NotificationDetails& details); - static void WriteAutofillProfile(const AutoFillProfile& profile, + static void WriteAutofillProfile(const AutofillProfile& profile, sync_api::WriteNode* node); protected: @@ -73,7 +73,7 @@ class AutofillProfileChangeProcessor : public ChangeProcessor, virtual void AddAutofillProfileSyncNode(sync_api::WriteTransaction* trans, sync_api::BaseNode& autofill_profile_root, - const AutoFillProfile& profile); + const AutofillProfile& profile); void ActOnChange(AutofillProfileChange* change, sync_api::WriteTransaction* trans, diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.cc b/chrome/browser/sync/glue/autofill_profile_model_associator.cc index 1cadaf0..d6b0cb9 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.cc @@ -45,22 +45,22 @@ AutofillProfileModelAssociator::AutofillProfileModelAssociator() number_of_profiles_created_(0) { } -bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutoFillProfiles( +bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutofillProfiles( sync_api::WriteTransaction* write_trans, const sync_api::ReadNode& autofill_root, - const std::vector<AutoFillProfile*>& all_profiles_from_db, + const std::vector<AutofillProfile*>& all_profiles_from_db, std::set<std::string>* current_profiles, - std::vector<AutoFillProfile*>* updated_profiles, - std::vector<AutoFillProfile*>* new_profiles, + std::vector<AutofillProfile*>* updated_profiles, + std::vector<AutofillProfile*>* new_profiles, std::vector<std::string>* profiles_to_delete) { if (VLOG_IS_ON(2)) { VLOG(2) << "[AUTOFILL MIGRATION]" << "Printing profiles from web db"; - for (std::vector<AutoFillProfile*>::const_iterator ix = + for (std::vector<AutofillProfile*>::const_iterator ix = all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) { - AutoFillProfile* p = *ix; + AutofillProfile* p = *ix; VLOG(2) << "[AUTOFILL MIGRATION] " << p->GetFieldText(AutofillType(NAME_FIRST)) << p->GetFieldText(AutofillType(NAME_LAST)) @@ -72,8 +72,8 @@ bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutoFillProfiles( << "Looking for the above data in sync db.."; // Alias the all_profiles_from_db so we fit in 80 characters - const std::vector<AutoFillProfile*>& profiles(all_profiles_from_db); - for (std::vector<AutoFillProfile*>::const_iterator ix = profiles.begin(); + const std::vector<AutofillProfile*>& profiles(all_profiles_from_db); + for (std::vector<AutofillProfile*>::const_iterator ix = profiles.begin(); ix != profiles.end(); ++ix) { std::string guid((*ix)->guid()); @@ -125,11 +125,11 @@ bool AutofillProfileModelAssociator::GetSyncIdForTaggedNode( } bool AutofillProfileModelAssociator::LoadAutofillData( - std::vector<AutoFillProfile*>* profiles) { + std::vector<AutofillProfile*>* profiles) { if (IsAbortPending()) return false; - if (!web_database_->GetAutoFillProfiles(profiles)) + if (!web_database_->GetAutofillProfiles(profiles)) return false; return true; @@ -143,7 +143,7 @@ bool AutofillProfileModelAssociator::AssociateModels() { abort_association_pending_ = false; } - ScopedVector<AutoFillProfile> profiles; + ScopedVector<AutofillProfile> profiles; if (!LoadAutofillData(&profiles.get())) { LOG(ERROR) << "Could not get the autofill data from WebDatabase."; @@ -166,7 +166,7 @@ bool AutofillProfileModelAssociator::AssociateModels() { return false; } - if (!TraverseAndAssociateChromeAutoFillProfiles(&trans, autofill_root, + if (!TraverseAndAssociateChromeAutofillProfiles(&trans, autofill_root, profiles.get(), &bundle.current_profiles, &bundle.updated_profiles, &bundle.new_profiles, @@ -233,10 +233,10 @@ bool AutofillProfileModelAssociator::SyncModelHasUserCreatedNodes( } // static bool AutofillProfileModelAssociator::OverwriteProfileWithServerData( - AutoFillProfile* merge_into, + AutofillProfile* merge_into, const sync_pb::AutofillProfileSpecifics& specifics) { bool diff = false; - AutoFillProfile* p = merge_into; + AutofillProfile* p = merge_into; const sync_pb::AutofillProfileSpecifics& s(specifics); diff = MergeField(p, NAME_FIRST, s.name_first()) || diff; diff = MergeField(p, NAME_LAST, s.name_last()) || diff; @@ -260,12 +260,12 @@ bool AutofillProfileModelAssociator::OverwriteProfileWithServerData( int64 AutofillProfileModelAssociator::FindSyncNodeWithProfile( sync_api::WriteTransaction* trans, const sync_api::BaseNode& autofill_root, - const AutoFillProfile& profile_from_db, + const AutofillProfile& profile_from_db, std::set<std::string>* current_profiles) { int64 sync_child_id = autofill_root.GetFirstChildId(); while (sync_child_id != sync_api::kInvalidId) { ReadNode read_node(trans); - AutoFillProfile p; + AutofillProfile p; if (!read_node.InitByIdLookup(sync_child_id)) { LOG(ERROR) << "unable to find the id given by getfirst child " << sync_child_id; @@ -290,8 +290,8 @@ int64 AutofillProfileModelAssociator::FindSyncNodeWithProfile( bool AutofillProfileModelAssociator::MakeNewAutofillProfileSyncNodeIfNeeded( sync_api::WriteTransaction* trans, const sync_api::BaseNode& autofill_root, - const AutoFillProfile& profile, - std::vector<AutoFillProfile*>* new_profiles, + const AutofillProfile& profile, + std::vector<AutofillProfile*>* new_profiles, std::set<std::string>* current_profiles, std::vector<std::string>* profiles_to_delete) { @@ -315,7 +315,7 @@ bool AutofillProfileModelAssociator::MakeNewAutofillProfileSyncNodeIfNeeded( autofill_specifics.guid(); return false; } - AutoFillProfile* p = new AutoFillProfile(autofill_specifics.guid()); + AutofillProfile* p = new AutofillProfile(autofill_specifics.guid()); OverwriteProfileWithServerData(p, autofill_specifics); new_profiles->push_back(p); std::string guid = autofill_specifics.guid(); @@ -405,7 +405,7 @@ void AutofillProfileModelAssociator::AddNativeProfileIfNeeded( bundle->current_profiles.end()) { std::string guid(profile.guid()); Associate(&guid, node.GetId()); - AutoFillProfile* p = new AutoFillProfile(profile.guid()); + AutofillProfile* p = new AutofillProfile(profile.guid()); OverwriteProfileWithServerData(p, profile); bundle->new_profiles.push_back(p); VLOG(2) << "[AUTOFILL MIGRATION] " @@ -426,21 +426,21 @@ bool AutofillProfileModelAssociator::SaveChangesToWebData( for (size_t i = 0; i < bundle.new_profiles.size(); i++) { if (IsAbortPending()) return false; - if (!web_database_->AddAutoFillProfile(*bundle.new_profiles[i])) + if (!web_database_->AddAutofillProfile(*bundle.new_profiles[i])) return false; } for (size_t i = 0; i < bundle.updated_profiles.size(); i++) { if (IsAbortPending()) return false; - if (!web_database_->UpdateAutoFillProfile(*bundle.updated_profiles[i])) + if (!web_database_->UpdateAutofillProfile(*bundle.updated_profiles[i])) return false; } for (size_t i = 0; i< bundle.profiles_to_delete.size(); ++i) { if (IsAbortPending()) return false; - if (!web_database_->RemoveAutoFillProfile(bundle.profiles_to_delete[i])) + if (!web_database_->RemoveAutofillProfile(bundle.profiles_to_delete[i])) return false; } return true; diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.h b/chrome/browser/sync/glue/autofill_profile_model_associator.h index 377d597..39485dec 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.h +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -20,7 +20,7 @@ #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" #include "chrome/browser/webdata/autofill_entry.h" -class AutoFillProfile; +class AutofillProfile; class ProfileSyncService; class WebDatabase; @@ -94,35 +94,35 @@ class AutofillProfileModelAssociator virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id); static bool OverwriteProfileWithServerData( - AutoFillProfile* merge_into, + AutofillProfile* merge_into, const sync_pb::AutofillProfileSpecifics& specifics); protected: AutofillProfileModelAssociator(); - bool TraverseAndAssociateChromeAutoFillProfiles( + bool TraverseAndAssociateChromeAutofillProfiles( sync_api::WriteTransaction* write_trans, const sync_api::ReadNode& autofill_root, - const std::vector<AutoFillProfile*>& all_profiles_from_db, + const std::vector<AutofillProfile*>& all_profiles_from_db, std::set<std::string>* current_profiles, - std::vector<AutoFillProfile*>* updated_profiles, - std::vector<AutoFillProfile*>* new_profiles, + std::vector<AutofillProfile*>* updated_profiles, + std::vector<AutofillProfile*>* new_profiles, std::vector<std::string>* profiles_to_delete); - // Helper to insert an AutoFillProfile into the WebDatabase (e.g. in response + // Helper to insert an AutofillProfile into the WebDatabase (e.g. in response // to encountering a sync node that doesn't exist yet locally). virtual void AddNativeProfileIfNeeded( const sync_pb::AutofillProfileSpecifics& profile, DataBundle* bundle, const sync_api::ReadNode& node); - // Helper to insert a sync node for the given AutoFillProfile (e.g. in + // Helper to insert a sync node for the given AutofillProfile (e.g. in // response to encountering a native profile that doesn't exist yet in the // cloud). virtual bool MakeNewAutofillProfileSyncNodeIfNeeded( sync_api::WriteTransaction* trans, const sync_api::BaseNode& autofill_root, - const AutoFillProfile& profile, - std::vector<AutoFillProfile*>* new_profiles, + const AutofillProfile& profile, + std::vector<AutofillProfile*>* new_profiles, std::set<std::string>* current_profiles, std::vector<std::string>* profiles_to_delete); @@ -142,7 +142,7 @@ class AutofillProfileModelAssociator // struct DataBundle; // Helper to query WebDatabase for the current autofill state. - bool LoadAutofillData(std::vector<AutoFillProfile*>* profiles); + bool LoadAutofillData(std::vector<AutofillProfile*>* profiles); static bool MergeField(FormGroup* f, AutofillFieldType t, @@ -158,7 +158,7 @@ class AutofillProfileModelAssociator int64 FindSyncNodeWithProfile(sync_api::WriteTransaction* trans, const sync_api::BaseNode& autofill_root, - const AutoFillProfile& profile, + const AutofillProfile& profile, std::set<std::string>* current_profiles); ProfileSyncService* sync_service_; @@ -186,8 +186,8 @@ struct AutofillProfileModelAssociator::DataBundle { std::set<std::string> current_profiles; std::vector<std::string> profiles_to_delete; - std::vector<AutoFillProfile*> updated_profiles; - std::vector<AutoFillProfile*> new_profiles; // We own these pointers. + std::vector<AutofillProfile*> updated_profiles; + std::vector<AutofillProfile*> new_profiles; // We own these pointers. }; } // namespace browser_sync diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc b/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc index 46287fd4..a1780d4 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc @@ -18,7 +18,7 @@ using ::testing::ReturnRef; using ::testing::Pointee; using ::testing::Ref; using ::testing::Invoke; -class AutoFillProfile; +class AutofillProfile; using browser_sync::AutofillProfileModelAssociator; @@ -31,15 +31,15 @@ class MockAutofillProfileModelAssociator MockAutofillProfileModelAssociator() { } virtual ~MockAutofillProfileModelAssociator() {} - bool TraverseAndAssociateChromeAutoFillProfilesWrapper( + bool TraverseAndAssociateChromeAutofillProfilesWrapper( sync_api::WriteTransaction* write_trans, const sync_api::ReadNode& autofill_root, - const std::vector<AutoFillProfile*>& all_profiles_from_db, + const std::vector<AutofillProfile*>& all_profiles_from_db, std::set<std::string>* current_profiles, - std::vector<AutoFillProfile*>* updated_profiles, - std::vector<AutoFillProfile*>* new_profiles, + std::vector<AutofillProfile*>* updated_profiles, + std::vector<AutofillProfile*>* new_profiles, std::vector<std::string>* profiles_to_delete) { - return TraverseAndAssociateChromeAutoFillProfiles(write_trans, + return TraverseAndAssociateChromeAutofillProfiles(write_trans, autofill_root, all_profiles_from_db, current_profiles, @@ -52,13 +52,13 @@ class MockAutofillProfileModelAssociator DataBundle*, const sync_api::ReadNode&)); MOCK_METHOD2(OverwriteProfileWithServerData, - bool(AutoFillProfile*, + bool(AutofillProfile*, const sync_pb::AutofillProfileSpecifics&)); MOCK_METHOD6(MakeNewAutofillProfileSyncNodeIfNeeded, bool(sync_api::WriteTransaction*, const sync_api::BaseNode&, - const AutoFillProfile&, - std::vector<AutoFillProfile*>*, + const AutofillProfile&, + std::vector<AutofillProfile*>*, std::set<std::string>*, std::vector<std::string>*)); MOCK_METHOD2(Associate, void(const std::string*, int64)); @@ -94,7 +94,7 @@ class AutofillProfileModelAssociatorTest : public testing::Test { TEST_F(AutofillProfileModelAssociatorTest, TestAssociateProfileInWebDBWithSyncDB) { - ScopedVector<AutoFillProfile> profiles_from_web_db; + ScopedVector<AutofillProfile> profiles_from_web_db; std::string guid = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; sync_pb::EntitySpecifics specifics; @@ -108,7 +108,7 @@ TEST_F(AutofillProfileModelAssociatorTest, // This will be released inside the function // TraverseAndAssociateChromeAutofillProfiles - AutoFillProfile *profile = new AutoFillProfile(guid); + AutofillProfile *profile = new AutofillProfile(guid); // Set up the entry kernel with what we want. EntryKernel kernel; @@ -125,7 +125,7 @@ TEST_F(AutofillProfileModelAssociatorTest, profiles_from_web_db.push_back(profile); - associator_.TraverseAndAssociateChromeAutoFillProfilesWrapper(&write_trans, + associator_.TraverseAndAssociateChromeAutofillProfilesWrapper(&write_trans, read_node, profiles_from_web_db.get(), ¤t_profiles, @@ -137,7 +137,7 @@ TEST_F(AutofillProfileModelAssociatorTest, } TEST_F(AutofillProfileModelAssociatorTest, TestAssociatingMissingWebDBProfile) { - ScopedVector<AutoFillProfile> profiles_from_web_db; + ScopedVector<AutofillProfile> profiles_from_web_db; MockDirectory mock_directory; MockWriteTransaction write_trans(&mock_directory); @@ -149,7 +149,7 @@ TEST_F(AutofillProfileModelAssociatorTest, TestAssociatingMissingWebDBProfile) { std::string guid = "EDC609ED-7EEE-4F27-B00C-423242A9C44A"; std::set<std::string> current_profiles; - AutoFillProfile *profile = new AutoFillProfile(guid); + AutofillProfile *profile = new AutofillProfile(guid); EXPECT_CALL(associator_, MakeNewAutofillProfileSyncNodeIfNeeded(&write_trans, @@ -162,7 +162,7 @@ TEST_F(AutofillProfileModelAssociatorTest, TestAssociatingMissingWebDBProfile) { profiles_from_web_db.push_back(profile); - associator_.TraverseAndAssociateChromeAutoFillProfilesWrapper(&write_trans, + associator_.TraverseAndAssociateChromeAutofillProfilesWrapper(&write_trans, autofill_root, profiles_from_web_db.get(), ¤t_profiles, diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 11f3c35..d8db395 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -103,19 +103,19 @@ class WebDatabaseMock : public WebDatabase { std::vector<base::Time>* timestamps)); MOCK_METHOD1(UpdateAutofillEntries, bool(const std::vector<AutofillEntry>&)); // NOLINT - MOCK_METHOD1(GetAutoFillProfiles, - bool(std::vector<AutoFillProfile*>*)); // NOLINT - MOCK_METHOD1(UpdateAutoFillProfile, - bool(const AutoFillProfile&)); // NOLINT - MOCK_METHOD1(AddAutoFillProfile, - bool(const AutoFillProfile&)); // NOLINT - MOCK_METHOD1(RemoveAutoFillProfile, + MOCK_METHOD1(GetAutofillProfiles, + bool(std::vector<AutofillProfile*>*)); // NOLINT + MOCK_METHOD1(UpdateAutofillProfile, + bool(const AutofillProfile&)); // NOLINT + MOCK_METHOD1(AddAutofillProfile, + bool(const AutofillProfile&)); // NOLINT + MOCK_METHOD1(RemoveAutofillProfile, bool(const std::string&)); // NOLINT }; class ProfileSyncServiceAutofillTest; -template<class AutoFillProfile> +template<class AutofillProfile> syncable::ModelType GetModelType() { return syncable::UNSPECIFIED; } @@ -126,7 +126,7 @@ syncable::ModelType GetModelType<AutofillEntry>() { } template<> -syncable::ModelType GetModelType<AutoFillProfile>() { +syncable::ModelType GetModelType<AutofillProfile>() { return syncable::AUTOFILL_PROFILE; } @@ -333,7 +333,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { return true; } - bool AddAutofillSyncNode(const AutoFillProfile& profile) { + bool AddAutofillSyncNode(const AutofillProfile& profile) { sync_api::WriteTransaction trans(service_->GetUserShare()); sync_api::ReadNode autofill_root(&trans); if (!autofill_root.InitByTagLookup(browser_sync::kAutofillProfileTag)) @@ -348,7 +348,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { } bool GetAutofillEntriesFromSyncDB(std::vector<AutofillEntry>* entries, - std::vector<AutoFillProfile>* profiles) { + std::vector<AutofillProfile>* profiles) { sync_api::ReadTransaction trans(service_->GetUserShare()); sync_api::ReadNode autofill_root(&trans); if (!autofill_root.InitByTagLookup(browser_sync::kAutofillTag)) @@ -373,7 +373,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { } entries->push_back(AutofillEntry(key, timestamps)); } else if (autofill.has_profile()) { - AutoFillProfile p; + AutofillProfile p; p.set_guid(autofill.profile().guid()); AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p, autofill.profile()); @@ -385,7 +385,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { } bool GetAutofillProfilesFromSyncDBUnderProfileNode( - std::vector<AutoFillProfile>* profiles) { + std::vector<AutofillProfile>* profiles) { sync_api::ReadTransaction trans(service_->GetUserShare()); sync_api::ReadNode autofill_root(&trans); if (!autofill_root.InitByTagLookup(browser_sync::kAutofillProfileTag)) @@ -399,7 +399,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { const sync_pb::AutofillProfileSpecifics& autofill( child_node.GetAutofillProfileSpecifics()); - AutoFillProfile p; + AutofillProfile p; p.set_guid(autofill.guid()); AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p, autofill); @@ -435,7 +435,7 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { } friend class AddAutofillTask<AutofillEntry>; - friend class AddAutofillTask<AutoFillProfile>; + friend class AddAutofillTask<AutofillProfile>; friend class FakeServerUpdater; BrowserThread db_thread_; @@ -614,14 +614,14 @@ TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) { TEST_F(ProfileSyncServiceAutofillTest, EmptyNativeEmptySync) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true)); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); SetIdleChangeProcessorExpectations(); CreateRootTask task(this, syncable::AUTOFILL); EXPECT_CALL(*personal_data_manager_, Refresh()); StartSyncService(&task, false, syncable::AUTOFILL); ASSERT_TRUE(task.success()); std::vector<AutofillEntry> sync_entries; - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); EXPECT_EQ(0U, sync_entries.size()); EXPECT_EQ(0U, sync_profiles.size()); @@ -632,14 +632,14 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeEntriesEmptySync) { entries.push_back(MakeAutofillEntry("foo", "bar", 1)); EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(DoAll(SetArgumentPointee<0>(entries), Return(true))); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); SetIdleChangeProcessorExpectations(); CreateRootTask task(this, syncable::AUTOFILL); EXPECT_CALL(*personal_data_manager_, Refresh()); StartSyncService(&task, false, syncable::AUTOFILL); ASSERT_TRUE(task.success()); std::vector<AutofillEntry> sync_entries; - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); ASSERT_EQ(1U, entries.size()); EXPECT_TRUE(entries[0] == sync_entries[0]); @@ -648,10 +648,10 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeEntriesEmptySync) { TEST_F(ProfileSyncServiceAutofillTest, HasProfileEmptySync) { - std::vector<AutoFillProfile*> profiles; - std::vector<AutoFillProfile> expected_profiles; - // Owned by GetAutoFillProfiles caller. - AutoFillProfile* profile0 = new AutoFillProfile; + std::vector<AutofillProfile*> profiles; + std::vector<AutofillProfile> expected_profiles; + // Owned by GetAutofillProfiles caller. + AutofillProfile* profile0 = new AutofillProfile; autofill_test::SetProfileInfoWithGuid(profile0, "54B3F9AA-335E-4F71-A27D-719C41564230", "Billing", "Mitchell", "Morrison", @@ -659,14 +659,14 @@ TEST_F(ProfileSyncServiceAutofillTest, HasProfileEmptySync) { "91601", "US", "12345678910", "01987654321"); profiles.push_back(profile0); expected_profiles.push_back(*profile0); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)). + EXPECT_CALL(web_database_, GetAutofillProfiles(_)). WillOnce(DoAll(SetArgumentPointee<0>(profiles), Return(true))); EXPECT_CALL(*personal_data_manager_, Refresh()); SetIdleChangeProcessorExpectations(); CreateRootTask task(this, syncable::AUTOFILL_PROFILE); StartSyncService(&task, false, syncable::AUTOFILL_PROFILE); ASSERT_TRUE(task.success()); - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode(&sync_profiles)); EXPECT_EQ(1U, sync_profiles.size()); EXPECT_EQ(0, expected_profiles[0].Compare(sync_profiles[0])); @@ -681,14 +681,14 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeWithDuplicatesEmptySync) { entries.push_back(MakeAutofillEntry("dup", "", 3)); EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(DoAll(SetArgumentPointee<0>(entries), Return(true))); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); SetIdleChangeProcessorExpectations(); CreateRootTask task(this, syncable::AUTOFILL); EXPECT_CALL(*personal_data_manager_, Refresh()); StartSyncService(&task, false, syncable::AUTOFILL); ASSERT_TRUE(task.success()); std::vector<AutofillEntry> sync_entries; - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); EXPECT_EQ(2U, sync_entries.size()); } @@ -703,7 +703,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncNoMerge) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(DoAll(SetArgumentPointee<0>(native_entries), Return(true))); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); std::vector<AutofillEntry> sync_entries; sync_entries.push_back(sync_entry); @@ -722,7 +722,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncNoMerge) { expected_entries.insert(sync_entry); std::vector<AutofillEntry> new_sync_entries; - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); std::set<AutofillEntry> new_sync_entries_set(new_sync_entries.begin(), @@ -740,7 +740,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) { native_entries.push_back(native_entry); EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(DoAll(SetArgumentPointee<0>(native_entries), Return(true))); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); std::vector<AutofillEntry> sync_entries; sync_entries.push_back(sync_entry); @@ -753,7 +753,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) { ASSERT_TRUE(task.success()); std::vector<AutofillEntry> new_sync_entries; - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(1U, new_sync_entries.size()); @@ -761,35 +761,35 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) { } TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) { - AutoFillProfile sync_profile; + AutofillProfile sync_profile; autofill_test::SetProfileInfoWithGuid(&sync_profile, "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - AutoFillProfile* native_profile = new AutoFillProfile; + AutofillProfile* native_profile = new AutofillProfile; autofill_test::SetProfileInfoWithGuid(native_profile, "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); - std::vector<AutoFillProfile*> native_profiles; + std::vector<AutofillProfile*> native_profiles; native_profiles.push_back(native_profile); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)). + EXPECT_CALL(web_database_, GetAutofillProfiles(_)). WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; sync_profiles.push_back(sync_profile); - AddAutofillTask<AutoFillProfile> task(this, sync_profiles); + AddAutofillTask<AutofillProfile> task(this, sync_profiles); - EXPECT_CALL(web_database_, UpdateAutoFillProfile(_)). + EXPECT_CALL(web_database_, UpdateAutofillProfile(_)). WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); StartSyncService(&task, false, syncable::AUTOFILL_PROFILE); ASSERT_TRUE(task.success()); - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode( &new_sync_profiles)); ASSERT_EQ(1U, new_sync_profiles.size()); @@ -797,7 +797,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) { } TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) { - AutoFillProfile sync_profile; + AutofillProfile sync_profile; autofill_test::SetProfileInfoWithGuid(&sync_profile, "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", @@ -806,31 +806,31 @@ TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) { "91601", "US", "12345678910", "01987654321"); std::string native_guid = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; - AutoFillProfile* native_profile = new AutoFillProfile; + AutofillProfile* native_profile = new AutofillProfile; autofill_test::SetProfileInfoWithGuid(native_profile, native_guid.c_str(), "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); - std::vector<AutoFillProfile*> native_profiles; + std::vector<AutofillProfile*> native_profiles; native_profiles.push_back(native_profile); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)). + EXPECT_CALL(web_database_, GetAutofillProfiles(_)). WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; sync_profiles.push_back(sync_profile); - AddAutofillTask<AutoFillProfile> task(this, sync_profiles); + AddAutofillTask<AutofillProfile> task(this, sync_profiles); - EXPECT_CALL(web_database_, AddAutoFillProfile(_)). + EXPECT_CALL(web_database_, AddAutofillProfile(_)). WillOnce(Return(true)); - EXPECT_CALL(web_database_, RemoveAutoFillProfile(native_guid)). + EXPECT_CALL(web_database_, RemoveAutofillProfile(native_guid)). WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); StartSyncService(&task, false, syncable::AUTOFILL_PROFILE); ASSERT_TRUE(task.success()); - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode( &new_sync_profiles)); ASSERT_EQ(1U, new_sync_profiles.size()); @@ -840,7 +840,7 @@ TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) { TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true)); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); SetIdleChangeProcessorExpectations(); CreateRootTask task(this, syncable::AUTOFILL); @@ -861,7 +861,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) { Details<AutofillChangeList>(&changes)); std::vector<AutofillEntry> new_sync_entries; - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(1U, new_sync_entries.size()); @@ -869,14 +869,14 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) { } TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); SetIdleChangeProcessorExpectations(); CreateRootTask task(this, syncable::AUTOFILL_PROFILE); StartSyncService(&task, false, syncable::AUTOFILL_PROFILE); ASSERT_TRUE(task.success()); - AutoFillProfile added_profile; + AutofillProfile added_profile; autofill_test::SetProfileInfoWithGuid(&added_profile, "D6ADA912-D374-4C0A-917D-F5C8EBE43011", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", @@ -889,7 +889,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode( &new_sync_profiles)); ASSERT_EQ(1U, new_sync_profiles.size()); @@ -903,7 +903,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(DoAll(SetArgumentPointee<0>(original_entries), Return(true))); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); CreateRootTask task(this, syncable::AUTOFILL); StartSyncService(&task, false, syncable::AUTOFILL); @@ -924,7 +924,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) { Details<AutofillChangeList>(&changes)); std::vector<AutofillEntry> new_sync_entries; - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(1U, new_sync_entries.size()); @@ -939,7 +939,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(DoAll(SetArgumentPointee<0>(original_entries), Return(true))); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); CreateRootTask task(this, syncable::AUTOFILL); StartSyncService(&task, false, syncable::AUTOFILL); @@ -954,32 +954,32 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) { Details<AutofillChangeList>(&changes)); std::vector<AutofillEntry> new_sync_entries; - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(0U, new_sync_entries.size()); } TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { - AutoFillProfile sync_profile; + AutofillProfile sync_profile; autofill_test::SetProfileInfoWithGuid(&sync_profile, "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); - AutoFillProfile* native_profile = new AutoFillProfile; + AutofillProfile* native_profile = new AutofillProfile; autofill_test::SetProfileInfoWithGuid(native_profile, "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); - std::vector<AutoFillProfile*> native_profiles; + std::vector<AutofillProfile*> native_profiles; native_profiles.push_back(native_profile); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)). + EXPECT_CALL(web_database_, GetAutofillProfiles(_)). WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; sync_profiles.push_back(sync_profile); - AddAutofillTask<AutoFillProfile> task(this, sync_profiles); + AddAutofillTask<AutofillProfile> task(this, sync_profiles); EXPECT_CALL(*personal_data_manager_, Refresh()); StartSyncService(&task, false, syncable::AUTOFILL_PROFILE); ASSERT_TRUE(task.success()); @@ -991,7 +991,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); - std::vector<AutoFillProfile> new_sync_profiles; + std::vector<AutofillProfile> new_sync_profiles; ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode( &new_sync_profiles)); ASSERT_EQ(0U, new_sync_profiles.size()); @@ -999,7 +999,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeError) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true)); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()); CreateRootTask task(this, syncable::AUTOFILL); StartSyncService(&task, false, syncable::AUTOFILL); @@ -1034,7 +1034,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeError) { // Crashy, http://crbug.com/57884 TEST_F(ProfileSyncServiceAutofillTest, DISABLED_ServerChangeRace) { EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true)); - EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true)); + EXPECT_CALL(web_database_, GetAutofillProfiles(_)).WillOnce(Return(true)); EXPECT_CALL(web_database_, UpdateAutofillEntries(_)). WillRepeatedly(Return(true)); EXPECT_CALL(*personal_data_manager_, Refresh()).Times(3); @@ -1065,7 +1065,7 @@ TEST_F(ProfileSyncServiceAutofillTest, DISABLED_ServerChangeRace) { updater->CreateNewEntryAndWait(MakeAutofillEntry("server2", "entry2", 3)); std::vector<AutofillEntry> sync_entries; - std::vector<AutoFillProfile> sync_profiles; + std::vector<AutofillProfile> sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); EXPECT_EQ(3U, sync_entries.size()); EXPECT_EQ(0U, sync_profiles.size()); diff --git a/chrome/browser/sync/protocol/autofill_specifics.proto b/chrome/browser/sync/protocol/autofill_specifics.proto index 520f25f..ae35da2 100644 --- a/chrome/browser/sync/protocol/autofill_specifics.proto +++ b/chrome/browser/sync/protocol/autofill_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. // @@ -81,7 +81,7 @@ message AutofillSpecifics { repeated int64 usage_timestamp = 3; // An autofill++ profile object. If present, indicates this entity - // represents an AutoFillProfile exclusively, and no other fields (such as + // represents an AutofillProfile exclusively, and no other fields (such as // name/value or credit_card) should be present. optional AutofillProfileSpecifics profile = 4; diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.cc b/chrome/browser/ui/views/autofill_profiles_view_win.cc index 3677c11..d3a9bfe 100644 --- a/chrome/browser/ui/views/autofill_profiles_view_win.cc +++ b/chrome/browser/ui/views/autofill_profiles_view_win.cc @@ -59,17 +59,17 @@ const int kSubViewVerticalInsets = 5; }; // namespace ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, static data: -AutoFillProfilesView* AutoFillProfilesView::instance_ = NULL; +// AutofillProfilesView, static data: +AutofillProfilesView* AutofillProfilesView::instance_ = NULL; ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, public: -AutoFillProfilesView::AutoFillProfilesView( +// AutofillProfilesView, public: +AutofillProfilesView::AutofillProfilesView( AutoFillDialogObserver* observer, PersonalDataManager* personal_data_manager, Profile* profile, PrefService* preferences, - AutoFillProfile* imported_profile, + AutofillProfile* imported_profile, CreditCard* imported_credit_card) : observer_(observer), personal_data_manager_(personal_data_manager), @@ -95,7 +95,7 @@ AutoFillProfilesView::AutoFillProfilesView( personal_data_manager_->SetObserver(this); } -AutoFillProfilesView::~AutoFillProfilesView() { +AutofillProfilesView::~AutofillProfilesView() { // Clear model as it gets deleted before the view. if (scroll_view_) scroll_view_->SetModel(NULL); @@ -105,15 +105,15 @@ AutoFillProfilesView::~AutoFillProfilesView() { } // TODO: get rid of imported_profile and imported_credit_card. -int AutoFillProfilesView::Show(gfx::NativeWindow parent, +int AutofillProfilesView::Show(gfx::NativeWindow parent, AutoFillDialogObserver* observer, PersonalDataManager* personal_data_manager, Profile* profile, PrefService* preferences, - AutoFillProfile* imported_profile, + AutofillProfile* imported_profile, CreditCard* imported_credit_card) { if (!instance_) { - instance_ = new AutoFillProfilesView(observer, personal_data_manager, + instance_ = new AutofillProfilesView(observer, personal_data_manager, profile, preferences, imported_profile, imported_credit_card); // |instance_| will get deleted once Close() is called. @@ -127,13 +127,13 @@ int AutoFillProfilesView::Show(gfx::NativeWindow parent, } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, protected: -void AutoFillProfilesView::AddClicked(int group_type) { +// AutofillProfilesView, protected: +void AutofillProfilesView::AddClicked(int group_type) { scoped_ptr<EditableSetInfo> info; std::vector<EditableSetInfo>::iterator it = profiles_set_.end(); int added_item_index = -1; if (group_type == ContentListTableModel::kAddressGroup) { - AutoFillProfile address; + AutofillProfile address; info.reset(new EditableSetInfo(&address)); } else if (group_type == ContentListTableModel::kCreditCardGroup) { CreditCard credit_card; @@ -148,7 +148,7 @@ void AutoFillProfilesView::AddClicked(int group_type) { edit_view->window()->Show(); } -void AutoFillProfilesView::EditClicked() { +void AutofillProfilesView::EditClicked() { int index = scroll_view_->FirstSelectedRow(); if (index == -1) return; // Happens if user double clicks and the table is empty. @@ -168,7 +168,7 @@ void AutoFillProfilesView::EditClicked() { edit_view->window()->Show(); } -void AutoFillProfilesView::DeleteClicked() { +void AutofillProfilesView::DeleteClicked() { DCHECK_GT(scroll_view_->SelectedRowCount(), 0); int last_view_row = -1; for (views::TableView::iterator i = scroll_view_->SelectionBegin(); @@ -184,7 +184,7 @@ void AutoFillProfilesView::DeleteClicked() { SaveData(); } -void AutoFillProfilesView::EditAccepted(EditableSetInfo* data, +void AutofillProfilesView::EditAccepted(EditableSetInfo* data, bool new_item) { DCHECK(data); std::vector<EditableSetInfo>::iterator it; @@ -216,7 +216,7 @@ void AutoFillProfilesView::EditAccepted(EditableSetInfo* data, SaveData(); } -void AutoFillProfilesView::UpdateWidgetState() { +void AutofillProfilesView::UpdateWidgetState() { bool autofill_enabled = enable_auto_fill_.GetValue(); enable_auto_fill_button_->SetChecked(autofill_enabled); enable_auto_fill_button_->SetEnabled(!enable_auto_fill_.IsManaged()); @@ -234,35 +234,35 @@ void AutoFillProfilesView::UpdateWidgetState() { autofill_enabled); } -void AutoFillProfilesView::ChildWindowOpened() { +void AutofillProfilesView::ChildWindowOpened() { child_dialog_opened_ = true; UpdateWidgetState(); } -void AutoFillProfilesView::ChildWindowClosed() { +void AutofillProfilesView::ChildWindowClosed() { child_dialog_opened_ = false; UpdateWidgetState(); } -SkBitmap* AutoFillProfilesView::GetWarningBitmap(bool good) { +SkBitmap* AutofillProfilesView::GetWarningBitmap(bool good) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); return rb.GetBitmapNamed(good ? IDR_INPUT_GOOD : IDR_INPUT_ALERT); } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, views::View implementations -void AutoFillProfilesView::Layout() { +// AutofillProfilesView, views::View implementations +void AutofillProfilesView::Layout() { View::Layout(); } -gfx::Size AutoFillProfilesView::GetPreferredSize() { +gfx::Size AutofillProfilesView::GetPreferredSize() { return views::Window::GetLocalizedContentsSize( IDS_AUTOFILL_DIALOG_WIDTH_CHARS, IDS_AUTOFILL_DIALOG_HEIGHT_LINES); } -void AutoFillProfilesView::ViewHierarchyChanged(bool is_add, +void AutofillProfilesView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (is_add && child == this) @@ -270,12 +270,12 @@ void AutoFillProfilesView::ViewHierarchyChanged(bool is_add, } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, views::DialogDelegate implementations: -int AutoFillProfilesView::GetDialogButtons() const { +// AutofillProfilesView, views::DialogDelegate implementations: +int AutofillProfilesView::GetDialogButtons() const { return MessageBoxFlags::DIALOGBUTTON_CANCEL; } -std::wstring AutoFillProfilesView::GetDialogButtonLabel( +std::wstring AutofillProfilesView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { switch (button) { case MessageBoxFlags::DIALOGBUTTON_CANCEL: @@ -287,7 +287,7 @@ std::wstring AutoFillProfilesView::GetDialogButtonLabel( return std::wstring(); } -views::View* AutoFillProfilesView::GetExtraView() { +views::View* AutofillProfilesView::GetExtraView() { // The dialog sizes the extra view to fill the entire available space. // We use a container to lay it out properly. views::View* link_container = new views::View(); @@ -308,7 +308,7 @@ views::View* AutoFillProfilesView::GetExtraView() { return link_container; } -bool AutoFillProfilesView::IsDialogButtonEnabled( +bool AutofillProfilesView::IsDialogButtonEnabled( MessageBoxFlags::DialogButton button) const { switch (button) { case MessageBoxFlags::DIALOGBUTTON_OK: @@ -322,31 +322,31 @@ bool AutoFillProfilesView::IsDialogButtonEnabled( } -std::wstring AutoFillProfilesView::GetWindowTitle() const { +std::wstring AutofillProfilesView::GetWindowTitle() const { return UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_TITLE)); } -void AutoFillProfilesView::WindowClosing() { +void AutofillProfilesView::WindowClosing() { focus_manager_->RemoveFocusChangeListener(this); instance_ = NULL; } -views::View* AutoFillProfilesView::GetContentsView() { +views::View* AutofillProfilesView::GetContentsView() { return this; } -bool AutoFillProfilesView::Cancel() { +bool AutofillProfilesView::Cancel() { // No way to cancel - we save back all the info always. return Accept(); } -bool AutoFillProfilesView::Accept() { +bool AutofillProfilesView::Accept() { return true; } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, views::ButtonListener implementations: -void AutoFillProfilesView::ButtonPressed(views::Button* sender, +// AutofillProfilesView, views::ButtonListener implementations: +void AutofillProfilesView::ButtonPressed(views::Button* sender, const views::Event& event) { if (sender == add_address_button_) { AddClicked(ContentListTableModel::kAddressGroup); @@ -368,8 +368,8 @@ void AutoFillProfilesView::ButtonPressed(views::Button* sender, } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, views::LinkController implementations: -void AutoFillProfilesView::LinkActivated(views::Link* source, int event_flags) { +// AutofillProfilesView, views::LinkController implementations: +void AutofillProfilesView::LinkActivated(views::Link* source, int event_flags) { Browser* browser = BrowserList::GetLastActive(); if (!browser || !browser->GetSelectedTabContents()) browser = Browser::Create(profile_); @@ -378,8 +378,8 @@ void AutoFillProfilesView::LinkActivated(views::Link* source, int event_flags) { ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, views::FocusChangeListener implementations: -void AutoFillProfilesView::FocusWillChange(views::View* focused_before, +// AutofillProfilesView, views::FocusChangeListener implementations: +void AutofillProfilesView::FocusWillChange(views::View* focused_before, views::View* focused_now) { if (focused_now) { focused_now->ScrollRectToVisible(gfx::Rect(focused_now->width(), @@ -388,26 +388,26 @@ void AutoFillProfilesView::FocusWillChange(views::View* focused_before, } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, views::TableViewObserver implementations: -void AutoFillProfilesView::OnSelectionChanged() { +// AutofillProfilesView, views::TableViewObserver implementations: +void AutofillProfilesView::OnSelectionChanged() { UpdateWidgetState(); } -void AutoFillProfilesView::OnDoubleClick() { +void AutofillProfilesView::OnDoubleClick() { if (!child_dialog_opened_) EditClicked(); } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, PersonalDataManager::Observer implementations. -void AutoFillProfilesView::OnPersonalDataLoaded() { +// AutofillProfilesView, PersonalDataManager::Observer implementations. +void AutofillProfilesView::OnPersonalDataLoaded() { GetData(); } -void AutoFillProfilesView::OnPersonalDataChanged() { +void AutofillProfilesView::OnPersonalDataChanged() { profiles_set_.clear(); - for (std::vector<AutoFillProfile*>::const_iterator address_it = + for (std::vector<AutofillProfile*>::const_iterator address_it = personal_data_manager_->profiles().begin(); address_it != personal_data_manager_->profiles().end(); ++address_it) { @@ -432,8 +432,8 @@ void AutoFillProfilesView::OnPersonalDataChanged() { } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, NotificationObserver implementation. -void AutoFillProfilesView::Observe(NotificationType type, +// AutofillProfilesView, NotificationObserver implementation. +void AutofillProfilesView::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { DCHECK_EQ(NotificationType::PREF_CHANGED, type.value); @@ -443,8 +443,8 @@ void AutoFillProfilesView::Observe(NotificationType type, } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView, private: -void AutoFillProfilesView::Init() { +// AutofillProfilesView, private: +void AutofillProfilesView::Init() { GetData(); enable_auto_fill_button_ = new views::Checkbox( @@ -514,7 +514,7 @@ void AutoFillProfilesView::Init() { UpdateWidgetState(); } -void AutoFillProfilesView::GetData() { +void AutofillProfilesView::GetData() { if (!personal_data_manager_->IsDataLoaded()) { return; } @@ -522,7 +522,7 @@ void AutoFillProfilesView::GetData() { !credit_card_set_.empty(); if (!imported_data_present) { profiles_set_.reserve(personal_data_manager_->profiles().size()); - for (std::vector<AutoFillProfile*>::const_iterator address_it = + for (std::vector<AutofillProfile*>::const_iterator address_it = personal_data_manager_->profiles().begin(); address_it != personal_data_manager_->profiles().end(); ++address_it) { @@ -549,12 +549,12 @@ void AutoFillProfilesView::GetData() { } } -bool AutoFillProfilesView::IsDataReady() const { +bool AutofillProfilesView::IsDataReady() const { return personal_data_manager_->IsDataLoaded(); } -void AutoFillProfilesView::SaveData() { - std::vector<AutoFillProfile> profiles; +void AutofillProfilesView::SaveData() { + std::vector<AutofillProfile> profiles; profiles.reserve(profiles_set_.size()); std::vector<EditableSetInfo>::iterator it; for (it = profiles_set_.begin(); it != profiles_set_.end(); ++it) { @@ -569,9 +569,9 @@ void AutoFillProfilesView::SaveData() { } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::PhoneSubView, public: -AutoFillProfilesView::PhoneSubView::PhoneSubView( - AutoFillProfilesView* autofill_view, +// AutofillProfilesView::PhoneSubView, public: +AutofillProfilesView::PhoneSubView::PhoneSubView( + AutofillProfilesView* autofill_view, views::Label* label, views::Textfield* text_phone) : autofill_view_(autofill_view), @@ -583,14 +583,14 @@ AutoFillProfilesView::PhoneSubView::PhoneSubView( DCHECK(text_phone_); } -void AutoFillProfilesView::PhoneSubView::ContentsChanged( +void AutofillProfilesView::PhoneSubView::ContentsChanged( views::Textfield* sender, const string16& new_contents) { if (sender == text_phone_) { UpdateButtons(); } } -bool AutoFillProfilesView::PhoneSubView::IsValid() const { +bool AutofillProfilesView::PhoneSubView::IsValid() const { if (text_phone_) { string16 phone = text_phone_->text(); if (phone.empty()) @@ -603,7 +603,7 @@ bool AutoFillProfilesView::PhoneSubView::IsValid() const { return false; } -void AutoFillProfilesView::PhoneSubView::UpdateButtons() { +void AutofillProfilesView::PhoneSubView::UpdateButtons() { if (phone_warning_button_) { SkBitmap* image = text_phone_->text().empty() ? NULL : autofill_view_->GetWarningBitmap(IsValid()); @@ -616,10 +616,10 @@ void AutoFillProfilesView::PhoneSubView::UpdateButtons() { } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::PhoneSubView, protected: +// AutofillProfilesView::PhoneSubView, protected: ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::PhoneSubView, views::View implementations -void AutoFillProfilesView::PhoneSubView::ViewHierarchyChanged( +// AutofillProfilesView::PhoneSubView, views::View implementations +void AutofillProfilesView::PhoneSubView::ViewHierarchyChanged( bool is_add, views::View* parent, views::View* child) { if (is_add && this == child) { views::GridLayout* layout = new views::GridLayout(this); @@ -651,43 +651,43 @@ void AutoFillProfilesView::PhoneSubView::ViewHierarchyChanged( } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, static data: -AutoFillProfilesView::EditableSetViewContents::TextFieldToAutoFill - AutoFillProfilesView::EditableSetViewContents::address_fields_[] = { - { AutoFillProfilesView::EditableSetViewContents::TEXT_FULL_NAME, +// AutofillProfilesView::EditableSetViewContents, static data: +AutofillProfilesView::EditableSetViewContents::TextFieldToAutoFill + AutofillProfilesView::EditableSetViewContents::address_fields_[] = { + { AutofillProfilesView::EditableSetViewContents::TEXT_FULL_NAME, NAME_FULL }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_COMPANY, COMPANY_NAME }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_EMAIL, EMAIL_ADDRESS }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_LINE_1, + { AutofillProfilesView::EditableSetViewContents::TEXT_COMPANY, COMPANY_NAME }, + { AutofillProfilesView::EditableSetViewContents::TEXT_EMAIL, EMAIL_ADDRESS }, + { AutofillProfilesView::EditableSetViewContents::TEXT_ADDRESS_LINE_1, ADDRESS_HOME_LINE1 }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_LINE_2, + { AutofillProfilesView::EditableSetViewContents::TEXT_ADDRESS_LINE_2, ADDRESS_HOME_LINE2 }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_CITY, + { AutofillProfilesView::EditableSetViewContents::TEXT_ADDRESS_CITY, ADDRESS_HOME_CITY }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_STATE, + { AutofillProfilesView::EditableSetViewContents::TEXT_ADDRESS_STATE, ADDRESS_HOME_STATE }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_ZIP, + { AutofillProfilesView::EditableSetViewContents::TEXT_ADDRESS_ZIP, ADDRESS_HOME_ZIP }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_COUNTRY, + { AutofillProfilesView::EditableSetViewContents::TEXT_ADDRESS_COUNTRY, ADDRESS_HOME_COUNTRY }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_PHONE_PHONE, + { AutofillProfilesView::EditableSetViewContents::TEXT_PHONE_PHONE, PHONE_HOME_WHOLE_NUMBER }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_FAX_PHONE, + { AutofillProfilesView::EditableSetViewContents::TEXT_FAX_PHONE, PHONE_FAX_WHOLE_NUMBER }, }; -AutoFillProfilesView::EditableSetViewContents::TextFieldToAutoFill - AutoFillProfilesView::EditableSetViewContents::credit_card_fields_[] = { - { AutoFillProfilesView::EditableSetViewContents::TEXT_CC_NAME, +AutofillProfilesView::EditableSetViewContents::TextFieldToAutoFill + AutofillProfilesView::EditableSetViewContents::credit_card_fields_[] = { + { AutofillProfilesView::EditableSetViewContents::TEXT_CC_NAME, CREDIT_CARD_NAME }, - { AutoFillProfilesView::EditableSetViewContents::TEXT_CC_NUMBER, + { AutofillProfilesView::EditableSetViewContents::TEXT_CC_NUMBER, CREDIT_CARD_NUMBER }, }; ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, public: -AutoFillProfilesView::EditableSetViewContents::EditableSetViewContents( - AutoFillProfilesView* observer, +// AutofillProfilesView::EditableSetViewContents, public: +AutofillProfilesView::EditableSetViewContents::EditableSetViewContents( + AutofillProfilesView* observer, bool new_item, const EditableSetInfo& field_set) : temporary_info_(field_set), @@ -698,14 +698,14 @@ AutoFillProfilesView::EditableSetViewContents::EditableSetViewContents( } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, protected: +// AutofillProfilesView::EditableSetViewContents, protected: ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, views::View implementations -void AutoFillProfilesView::EditableSetViewContents::Layout() { +// AutofillProfilesView::EditableSetViewContents, views::View implementations +void AutofillProfilesView::EditableSetViewContents::Layout() { View::Layout(); } -gfx::Size AutoFillProfilesView::EditableSetViewContents::GetPreferredSize() { +gfx::Size AutofillProfilesView::EditableSetViewContents::GetPreferredSize() { if (temporary_info_.is_address) { return views::Window::GetLocalizedContentsSize( IDS_AUTOFILL_DIALOG_EDIT_ADDRESS_WIDTH_CHARS, @@ -717,7 +717,7 @@ gfx::Size AutoFillProfilesView::EditableSetViewContents::GetPreferredSize() { } } -void AutoFillProfilesView::EditableSetViewContents::ViewHierarchyChanged( +void AutofillProfilesView::EditableSetViewContents::ViewHierarchyChanged( bool is_add, views::View* parent, views::View* child) { if (is_add && this == child) { observer_->ChildWindowOpened(); @@ -734,15 +734,15 @@ void AutoFillProfilesView::EditableSetViewContents::ViewHierarchyChanged( } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, +// AutofillProfilesView::EditableSetViewContents, // views::DialogDelegate implementations -int AutoFillProfilesView::EditableSetViewContents::GetDialogButtons() const { +int AutofillProfilesView::EditableSetViewContents::GetDialogButtons() const { return MessageBoxFlags::DIALOGBUTTON_CANCEL | MessageBoxFlags::DIALOGBUTTON_OK; } std::wstring -AutoFillProfilesView::EditableSetViewContents::GetDialogButtonLabel( +AutofillProfilesView::EditableSetViewContents::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { switch (button) { case MessageBoxFlags::DIALOGBUTTON_OK: @@ -756,7 +756,7 @@ AutoFillProfilesView::EditableSetViewContents::GetDialogButtonLabel( return std::wstring(); } -bool AutoFillProfilesView::EditableSetViewContents::IsDialogButtonEnabled( +bool AutofillProfilesView::EditableSetViewContents::IsDialogButtonEnabled( MessageBoxFlags::DialogButton button) const { switch (button) { case MessageBoxFlags::DIALOGBUTTON_OK: { @@ -803,7 +803,7 @@ bool AutoFillProfilesView::EditableSetViewContents::IsDialogButtonEnabled( } std::wstring -AutoFillProfilesView::EditableSetViewContents::GetWindowTitle() const { +AutofillProfilesView::EditableSetViewContents::GetWindowTitle() const { int string_id = 0; if (temporary_info_.is_address) { string_id = new_item_ ? IDS_AUTOFILL_ADD_ADDRESS_CAPTION : @@ -815,35 +815,35 @@ AutoFillProfilesView::EditableSetViewContents::GetWindowTitle() const { return UTF16ToWide(l10n_util::GetStringUTF16(string_id)); } -void AutoFillProfilesView::EditableSetViewContents::WindowClosing() { +void AutofillProfilesView::EditableSetViewContents::WindowClosing() { observer_->ChildWindowClosed(); } -views::View* AutoFillProfilesView::EditableSetViewContents::GetContentsView() { +views::View* AutofillProfilesView::EditableSetViewContents::GetContentsView() { return this; } -bool AutoFillProfilesView::EditableSetViewContents::Cancel() { +bool AutofillProfilesView::EditableSetViewContents::Cancel() { return true; } -bool AutoFillProfilesView::EditableSetViewContents::Accept() { +bool AutofillProfilesView::EditableSetViewContents::Accept() { observer_->EditAccepted(&temporary_info_, new_item_); return true; } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, +// AutofillProfilesView::EditableSetViewContents, // views::ButtonListener implementations -void AutoFillProfilesView::EditableSetViewContents::ButtonPressed( +void AutofillProfilesView::EditableSetViewContents::ButtonPressed( views::Button* sender, const views::Event& event) { NOTREACHED(); } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, +// AutofillProfilesView::EditableSetViewContents, // views::TextfieldController implementations: -void AutoFillProfilesView::EditableSetViewContents::ContentsChanged( +void AutofillProfilesView::EditableSetViewContents::ContentsChanged( views::Textfield* sender, const string16& new_contents) { if (temporary_info_.is_address) { for (int field = 0; field < arraysize(address_fields_); ++field) { @@ -873,7 +873,7 @@ void AutoFillProfilesView::EditableSetViewContents::ContentsChanged( } } -bool AutoFillProfilesView::EditableSetViewContents::HandleKeyEvent( +bool AutofillProfilesView::EditableSetViewContents::HandleKeyEvent( views::Textfield* sender, const views::KeyEvent& key_event) { if (sender == text_fields_[TEXT_CC_NUMBER] && !has_credit_card_number_been_edited_) { @@ -885,9 +885,9 @@ bool AutoFillProfilesView::EditableSetViewContents::HandleKeyEvent( } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, +// AutofillProfilesView::EditableSetViewContents, // views::Combobox::Listener implementations: -void AutoFillProfilesView::EditableSetViewContents::ItemChanged( +void AutofillProfilesView::EditableSetViewContents::ItemChanged( views::Combobox* combo_box, int prev_index, int new_index) { if (combo_box == combo_box_month_) { if (new_index == -1) { @@ -911,8 +911,8 @@ void AutoFillProfilesView::EditableSetViewContents::ItemChanged( } ///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::EditableSetViewContents, private: -void AutoFillProfilesView::EditableSetViewContents::InitAddressFields( +// AutofillProfilesView::EditableSetViewContents, private: +void AutofillProfilesView::EditableSetViewContents::InitAddressFields( views::GridLayout* layout) { DCHECK(temporary_info_.is_address); @@ -1009,7 +1009,7 @@ void AutoFillProfilesView::EditableSetViewContents::InitAddressFields( UpdateButtons(); } -void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( +void AutofillProfilesView::EditableSetViewContents::InitCreditCardFields( views::GridLayout* layout) { DCHECK(!temporary_info_.is_address); @@ -1089,7 +1089,7 @@ void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( UpdateButtons(); } -void AutoFillProfilesView::EditableSetViewContents::InitLayoutGrid( +void AutofillProfilesView::EditableSetViewContents::InitLayoutGrid( views::GridLayout* layout) { views::ColumnSet* column_set = layout->AddColumnSet(double_column_fill_view_set_id_); @@ -1170,7 +1170,7 @@ void AutoFillProfilesView::EditableSetViewContents::InitLayoutGrid( } views::Label* -AutoFillProfilesView::EditableSetViewContents::CreateLeftAlignedLabel( +AutofillProfilesView::EditableSetViewContents::CreateLeftAlignedLabel( int label_id) { views::Label* label = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(label_id))); @@ -1178,11 +1178,11 @@ AutoFillProfilesView::EditableSetViewContents::CreateLeftAlignedLabel( return label; } -void AutoFillProfilesView::EditableSetViewContents::UpdateButtons() { +void AutofillProfilesView::EditableSetViewContents::UpdateButtons() { GetDialogClientView()->UpdateDialogButtons(); } -bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( +bool AutofillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( TextFields field, views::Textfield* sender, const string16& new_contents) { switch (field) { case TEXT_PHONE_PHONE: @@ -1208,21 +1208,21 @@ bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( return false; } -void AutoFillProfilesView::StringVectorComboboxModel::set_cb_strings( +void AutofillProfilesView::StringVectorComboboxModel::set_cb_strings( std::vector<std::wstring> *source) { cb_strings_.swap(*source); } -int AutoFillProfilesView::StringVectorComboboxModel::GetItemCount() { +int AutofillProfilesView::StringVectorComboboxModel::GetItemCount() { return cb_strings_.size(); } -string16 AutoFillProfilesView::StringVectorComboboxModel::GetItemAt(int index) { +string16 AutofillProfilesView::StringVectorComboboxModel::GetItemAt(int index) { DCHECK_GT(static_cast<int>(cb_strings_.size()), index); return WideToUTF16Hack(cb_strings_[index]); } -int AutoFillProfilesView::StringVectorComboboxModel::GetIndex( +int AutofillProfilesView::StringVectorComboboxModel::GetIndex( const std::wstring& value) { for (size_t index = 0; index < cb_strings_.size(); ++index) { if (cb_strings_[index] == value) @@ -1231,7 +1231,7 @@ int AutoFillProfilesView::StringVectorComboboxModel::GetIndex( return -1; } -AutoFillProfilesView::ContentListTableModel::ContentListTableModel( +AutofillProfilesView::ContentListTableModel::ContentListTableModel( std::vector<EditableSetInfo>* profiles, std::vector<EditableSetInfo>* credit_cards) : profiles_(profiles), @@ -1239,17 +1239,17 @@ AutoFillProfilesView::ContentListTableModel::ContentListTableModel( observer_(NULL) { } -void AutoFillProfilesView::ContentListTableModel::Refresh() { +void AutofillProfilesView::ContentListTableModel::Refresh() { if (observer_) observer_->OnModelChanged(); } -void AutoFillProfilesView::ContentListTableModel::AddItem(int index) { +void AutofillProfilesView::ContentListTableModel::AddItem(int index) { if (observer_) observer_->OnItemsAdded(index, 1); } -void AutoFillProfilesView::ContentListTableModel::RemoveItem(int index) { +void AutofillProfilesView::ContentListTableModel::RemoveItem(int index) { DCHECK(index < static_cast<int>(profiles_->size() + credit_cards_->size())); if (index < static_cast<int>(profiles_->size())) profiles_->erase(profiles_->begin() + index); @@ -1259,16 +1259,16 @@ void AutoFillProfilesView::ContentListTableModel::RemoveItem(int index) { observer_->OnItemsRemoved(index, 1); } -void AutoFillProfilesView::ContentListTableModel::UpdateItem(int index) { +void AutofillProfilesView::ContentListTableModel::UpdateItem(int index) { if (observer_) observer_->OnItemsChanged(index, 1); } -int AutoFillProfilesView::ContentListTableModel::RowCount() { +int AutofillProfilesView::ContentListTableModel::RowCount() { return profiles_->size() + credit_cards_->size(); } -string16 AutoFillProfilesView::ContentListTableModel::GetText( +string16 AutofillProfilesView::ContentListTableModel::GetText( int row, int column_id) { DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size())); if (row < static_cast<int>(profiles_->size())) { @@ -1280,7 +1280,7 @@ string16 AutoFillProfilesView::ContentListTableModel::GetText( } ui::TableModel::Groups - AutoFillProfilesView::ContentListTableModel::GetGroups() { + AutofillProfilesView::ContentListTableModel::GetGroups() { ui::TableModel::Groups groups; ui::TableModel::Group profile_group; @@ -1298,13 +1298,13 @@ ui::TableModel::Groups return groups; } -int AutoFillProfilesView::ContentListTableModel::GetGroupID(int row) { +int AutofillProfilesView::ContentListTableModel::GetGroupID(int row) { DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size())); return (row < static_cast<int>(profiles_->size())) ? kAddressGroup : kCreditCardGroup; } -void AutoFillProfilesView::ContentListTableModel::SetObserver( +void AutofillProfilesView::ContentListTableModel::SetObserver( ui::TableModelObserver* observer) { observer_ = observer; } @@ -1319,6 +1319,6 @@ void ShowAutoFillDialog(gfx::NativeView parent, PersonalDataManager* personal_data_manager = profile->GetPersonalDataManager(); DCHECK(personal_data_manager); - AutoFillProfilesView::Show(parent, observer, personal_data_manager, profile, + AutofillProfilesView::Show(parent, observer, personal_data_manager, profile, profile->GetPrefs(), NULL, NULL); } diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.h b/chrome/browser/ui/views/autofill_profiles_view_win.h index 9e4d776..5206167 100644 --- a/chrome/browser/ui/views/autofill_profiles_view_win.h +++ b/chrome/browser/ui/views/autofill_profiles_view_win.h @@ -41,7 +41,7 @@ class PrefService; class SkBitmap; /////////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView +// AutofillProfilesView // // The contents of the "AutoFill profiles" dialog window. // @@ -54,7 +54,7 @@ class SkBitmap; // And there is a support data structure EditableSetInfo which encapsulates // editable set (address or credit card) and allows for quick addition and // deletion. -class AutoFillProfilesView : public views::View, +class AutofillProfilesView : public views::View, public views::DialogDelegate, public views::ButtonListener, public views::LinkController, @@ -63,14 +63,14 @@ class AutoFillProfilesView : public views::View, public PersonalDataManager::Observer, public NotificationObserver { public: - virtual ~AutoFillProfilesView(); + virtual ~AutofillProfilesView(); static int Show(gfx::NativeWindow parent, AutoFillDialogObserver* observer, PersonalDataManager* personal_data_manager, Profile* profile, PrefService* preferences, - AutoFillProfile* imported_profile, + AutofillProfile* imported_profile, CreditCard* imported_credit_card); protected: @@ -155,10 +155,10 @@ class AutoFillProfilesView : public views::View, bool is_address; // If |is_address| is true |address| has some data and |credit_card| // is empty, and vice versa - AutoFillProfile address; + AutofillProfile address; CreditCard credit_card; - explicit EditableSetInfo(const AutoFillProfile* input_address) + explicit EditableSetInfo(const AutofillProfile* input_address) : address(*input_address), is_address(true) { } @@ -187,11 +187,11 @@ class AutoFillProfilesView : public views::View, FocusedItem(int g, int i) : group(g), item(i) {} }; - AutoFillProfilesView(AutoFillDialogObserver* observer, + AutofillProfilesView(AutoFillDialogObserver* observer, PersonalDataManager* personal_data_manager, Profile* profile, PrefService* preferences, - AutoFillProfile* imported_profile, + AutofillProfile* imported_profile, CreditCard* imported_credit_card); void Init(); @@ -207,7 +207,7 @@ class AutoFillProfilesView : public views::View, class PhoneSubView : public views::View, public views::ButtonListener { public: - PhoneSubView(AutoFillProfilesView* autofill_view, + PhoneSubView(AutofillProfilesView* autofill_view, views::Label* label, views::Textfield* text_phone); virtual ~PhoneSubView() {} @@ -233,7 +233,7 @@ class AutoFillProfilesView : public views::View, private: void UpdateButtons(); - AutoFillProfilesView* autofill_view_; + AutofillProfilesView* autofill_view_; views::Label* label_; views::Textfield* text_phone_; views::ImageButton* phone_warning_button_; @@ -252,7 +252,7 @@ class AutoFillProfilesView : public views::View, public views::TextfieldController, public views::Combobox::Listener { public: - EditableSetViewContents(AutoFillProfilesView* observer, + EditableSetViewContents(AutofillProfilesView* observer, bool new_item, const EditableSetInfo& field_set); virtual ~EditableSetViewContents() {} @@ -331,7 +331,7 @@ class AutoFillProfilesView : public views::View, views::Textfield* text_fields_[MAX_TEXT_FIELD]; EditableSetInfo temporary_info_; bool has_credit_card_number_been_edited_; - AutoFillProfilesView* observer_; + AutofillProfilesView* observer_; scoped_ptr<StringVectorComboboxModel> combo_box_model_month_; views::Combobox* combo_box_month_; scoped_ptr<StringVectorComboboxModel> combo_box_model_year_; @@ -434,9 +434,9 @@ class AutoFillProfilesView : public views::View, views::FocusManager* focus_manager_; bool child_dialog_opened_; - static AutoFillProfilesView* instance_; + static AutofillProfilesView* instance_; - DISALLOW_COPY_AND_ASSIGN(AutoFillProfilesView); + DISALLOW_COPY_AND_ASSIGN(AutofillProfilesView); }; #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_PROFILES_VIEW_WIN_H_ diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc index c48338c..78adaf9 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc @@ -193,7 +193,7 @@ void AutoFillOptionsHandler::LoadAutoFillData() { return; ListValue addresses; - for (std::vector<AutoFillProfile*>::const_iterator i = + for (std::vector<AutofillProfile*>::const_iterator i = personal_data_->web_profiles().begin(); i != personal_data_->web_profiles().end(); ++i) { ListValue* entry = new ListValue(); @@ -254,7 +254,7 @@ void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) { return; } - AutoFillProfile* profile = personal_data_->GetProfileByGUID(guid); + AutofillProfile* profile = personal_data_->GetProfileByGUID(guid); if (!profile) { // There is a race where a user can click once on the close button and // quickly click again on the list item before the item is removed (since @@ -344,7 +344,7 @@ void AutoFillOptionsHandler::SetAddress(const ListValue* args) { return; } - AutoFillProfile profile(guid); + AutofillProfile profile(guid); std::string country_code; string16 value; diff --git a/chrome/browser/webdata/autofill_change.cc b/chrome/browser/webdata/autofill_change.cc index e78a4ab..454d7b9 100644 --- a/chrome/browser/webdata/autofill_change.cc +++ b/chrome/browser/webdata/autofill_change.cc @@ -15,7 +15,7 @@ AutofillChange::~AutofillChange() { } AutofillProfileChange::AutofillProfileChange( - Type type, std::string key, const AutoFillProfile* profile) + Type type, std::string key, const AutofillProfile* profile) : GenericAutofillChange<std::string>(type, key), profile_(profile) { DCHECK(type == ADD ? (profile && profile->guid() == key) : true); diff --git a/chrome/browser/webdata/autofill_change.h b/chrome/browser/webdata/autofill_change.h index 1c7449e..37ad33f 100644 --- a/chrome/browser/webdata/autofill_change.h +++ b/chrome/browser/webdata/autofill_change.h @@ -8,11 +8,11 @@ #include "chrome/browser/webdata/autofill_entry.h" -class AutoFillProfile; +class AutofillProfile; class CreditCard; // For classic Autofill form fields, the KeyType is AutofillKey. -// Autofill++ types such as AutoFillProfile and CreditCard simply use an int. +// Autofill++ types such as AutofillProfile and CreditCard simply use an int. template <typename KeyType> class GenericAutofillChange { public: @@ -55,15 +55,15 @@ class AutofillProfileChange : public GenericAutofillChange<std::string> { // When |type| == REMOVE, |profile| should be NULL. AutofillProfileChange(Type type, std::string key, - const AutoFillProfile* profile); + const AutofillProfile* profile); virtual ~AutofillProfileChange(); - const AutoFillProfile* profile() const { return profile_; } + const AutofillProfile* profile() const { return profile_; } bool operator==(const AutofillProfileChange& change) const; private: // Weak reference, can be NULL. - const AutoFillProfile* profile_; + const AutofillProfile* profile_; }; // Change notification details for AutoFill credit card changes. diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index f75a47a..21f8ee1 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -391,44 +391,44 @@ void WebDataService::RemoveFormValueForElementName( request)); } -void WebDataService::AddAutoFillProfile(const AutoFillProfile& profile) { - GenericRequest<AutoFillProfile>* request = - new GenericRequest<AutoFillProfile>( +void WebDataService::AddAutofillProfile(const AutofillProfile& profile) { + GenericRequest<AutofillProfile>* request = + new GenericRequest<AutofillProfile>( this, GetNextRequestHandle(), NULL, profile); RegisterRequest(request); ScheduleTask(NewRunnableMethod(this, - &WebDataService::AddAutoFillProfileImpl, + &WebDataService::AddAutofillProfileImpl, request)); } -void WebDataService::UpdateAutoFillProfile(const AutoFillProfile& profile) { - GenericRequest<AutoFillProfile>* request = - new GenericRequest<AutoFillProfile>( +void WebDataService::UpdateAutofillProfile(const AutofillProfile& profile) { + GenericRequest<AutofillProfile>* request = + new GenericRequest<AutofillProfile>( this, GetNextRequestHandle(), NULL, profile); RegisterRequest(request); ScheduleTask(NewRunnableMethod(this, - &WebDataService::UpdateAutoFillProfileImpl, + &WebDataService::UpdateAutofillProfileImpl, request)); } -void WebDataService::RemoveAutoFillProfile(const std::string& guid) { +void WebDataService::RemoveAutofillProfile(const std::string& guid) { GenericRequest<std::string>* request = new GenericRequest<std::string>( this, GetNextRequestHandle(), NULL, guid); RegisterRequest(request); ScheduleTask(NewRunnableMethod(this, - &WebDataService::RemoveAutoFillProfileImpl, + &WebDataService::RemoveAutofillProfileImpl, request)); } -WebDataService::Handle WebDataService::GetAutoFillProfiles( +WebDataService::Handle WebDataService::GetAutofillProfiles( WebDataServiceConsumer* consumer) { WebDataRequest* request = new WebDataRequest(this, GetNextRequestHandle(), consumer); RegisterRequest(request); ScheduleTask( NewRunnableMethod(this, - &WebDataService::GetAutoFillProfilesImpl, + &WebDataService::GetAutofillProfilesImpl, request)); return request->GetHandle(); } @@ -475,7 +475,7 @@ WebDataService::Handle WebDataService::GetCreditCards( return request->GetHandle(); } -void WebDataService::RemoveAutoFillProfilesAndCreditCardsModifiedBetween( +void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetween( const Time& delete_begin, const Time& delete_end) { GenericRequest2<Time, Time>* request = @@ -487,7 +487,7 @@ void WebDataService::RemoveAutoFillProfilesAndCreditCardsModifiedBetween( RegisterRequest(request); ScheduleTask(NewRunnableMethod( this, - &WebDataService::RemoveAutoFillProfilesAndCreditCardsModifiedBetweenImpl, + &WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl, request)); } @@ -530,10 +530,10 @@ void WebDataService::RequestCompleted(Handle h) { WDTypedResult const *result = request->GetResult(); if (result) { if (result->GetType() == AUTOFILL_PROFILES_RESULT) { - const WDResult<std::vector<AutoFillProfile*> >* r = - static_cast<const WDResult<std::vector<AutoFillProfile*> >*>( + const WDResult<std::vector<AutofillProfile*> >* r = + static_cast<const WDResult<std::vector<AutofillProfile*> >*>( result); - std::vector<AutoFillProfile*> profiles = r->GetValue(); + std::vector<AutofillProfile*> profiles = r->GetValue(); STLDeleteElements(&profiles); } else if (result->GetType() == AUTOFILL_CREDITCARDS_RESULT) { const WDResult<std::vector<CreditCard*> >* r = @@ -991,12 +991,12 @@ void WebDataService::RemoveFormValueForElementNameImpl( request->RequestComplete(); } -void WebDataService::AddAutoFillProfileImpl( - GenericRequest<AutoFillProfile>* request) { +void WebDataService::AddAutofillProfileImpl( + GenericRequest<AutofillProfile>* request) { InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { - const AutoFillProfile& profile = request->GetArgument(); - if (!db_->AddAutoFillProfile(profile)) { + const AutofillProfile& profile = request->GetArgument(); + if (!db_->AddAutofillProfile(profile)) { NOTREACHED(); return; } @@ -1013,23 +1013,23 @@ void WebDataService::AddAutoFillProfileImpl( request->RequestComplete(); } -void WebDataService::UpdateAutoFillProfileImpl( - GenericRequest<AutoFillProfile>* request) { +void WebDataService::UpdateAutofillProfileImpl( + GenericRequest<AutofillProfile>* request) { InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { - const AutoFillProfile& profile = request->GetArgument(); + const AutofillProfile& profile = request->GetArgument(); // Only perform the update if the profile exists. It is currently // valid to try to update a missing profile. We simply drop the write and // the caller will detect this on the next refresh. - AutoFillProfile* original_profile = NULL; - if (!db_->GetAutoFillProfile(profile.guid(), &original_profile)) { + AutofillProfile* original_profile = NULL; + if (!db_->GetAutofillProfile(profile.guid(), &original_profile)) { request->RequestComplete(); return; } - scoped_ptr<AutoFillProfile> scoped_profile(original_profile); + scoped_ptr<AutofillProfile> scoped_profile(original_profile); - if (!db_->UpdateAutoFillProfile(profile)) { + if (!db_->UpdateAutofillProfile(profile)) { NOTREACHED(); return; } @@ -1046,20 +1046,20 @@ void WebDataService::UpdateAutoFillProfileImpl( request->RequestComplete(); } -void WebDataService::RemoveAutoFillProfileImpl( +void WebDataService::RemoveAutofillProfileImpl( GenericRequest<std::string>* request) { InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { std::string guid = request->GetArgument(); - AutoFillProfile* profile = NULL; - if (!db_->GetAutoFillProfile(guid, &profile)) { + AutofillProfile* profile = NULL; + if (!db_->GetAutofillProfile(guid, &profile)) { NOTREACHED(); return; } - scoped_ptr<AutoFillProfile> scoped_profile(profile); + scoped_ptr<AutofillProfile> scoped_profile(profile); - if (!db_->RemoveAutoFillProfile(guid)) { + if (!db_->RemoveAutofillProfile(guid)) { NOTREACHED(); return; } @@ -1075,13 +1075,13 @@ void WebDataService::RemoveAutoFillProfileImpl( request->RequestComplete(); } -void WebDataService::GetAutoFillProfilesImpl(WebDataRequest* request) { +void WebDataService::GetAutofillProfilesImpl(WebDataRequest* request) { InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { - std::vector<AutoFillProfile*> profiles; - db_->GetAutoFillProfiles(&profiles); + std::vector<AutofillProfile*> profiles; + db_->GetAutofillProfiles(&profiles); request->SetResult( - new WDResult<std::vector<AutoFillProfile*> >(AUTOFILL_PROFILES_RESULT, + new WDResult<std::vector<AutofillProfile*> >(AUTOFILL_PROFILES_RESULT, profiles)); } request->RequestComplete(); @@ -1175,11 +1175,11 @@ void WebDataService::GetCreditCardsImpl(WebDataRequest* request) { request->RequestComplete(); } -void WebDataService::RemoveAutoFillProfilesAndCreditCardsModifiedBetweenImpl( +void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl( GenericRequest2<Time, Time>* request) { InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { - if (db_->RemoveAutoFillProfilesAndCreditCardsModifiedBetween( + if (db_->RemoveAutofillProfilesAndCreditCardsModifiedBetween( request->GetArgument1(), request->GetArgument2())) { // Note: It is the caller's responsibility to post notifications for any diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 8e8b211..2dde084 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -19,7 +19,7 @@ #include "webkit/glue/form_field.h" class AutofillChange; -class AutoFillProfile; +class AutofillProfile; class CreditCard; class GURL; #if defined(OS_WIN) @@ -70,8 +70,8 @@ typedef enum { TOKEN_RESULT, // WDResult<std::vector<std::string>> AUTOFILL_VALUE_RESULT, // WDResult<std::vector<string16>> AUTOFILL_CHANGES, // WDResult<std::vector<AutofillChange>> - AUTOFILL_PROFILE_RESULT, // WDResult<AutoFillProfile> - AUTOFILL_PROFILES_RESULT, // WDResult<std::vector<AutoFillProfile*>> + AUTOFILL_PROFILE_RESULT, // WDResult<AutofillProfile> + AUTOFILL_PROFILES_RESULT, // WDResult<std::vector<AutofillProfile*>> AUTOFILL_CREDITCARD_RESULT, // WDResult<CreditCard> AUTOFILL_CREDITCARDS_RESULT // WDResult<std::vector<CreditCard*>> } WDResultType; @@ -439,20 +439,20 @@ class WebDataService const string16& value); // Schedules a task to add an AutoFill profile to the web database. - void AddAutoFillProfile(const AutoFillProfile& profile); + void AddAutofillProfile(const AutofillProfile& profile); // Schedules a task to update an AutoFill profile in the web database. - void UpdateAutoFillProfile(const AutoFillProfile& profile); + void UpdateAutofillProfile(const AutofillProfile& profile); // Schedules a task to remove an AutoFill profile from the web database. // |guid| is the identifer of the profile to remove. - void RemoveAutoFillProfile(const std::string& guid); + void RemoveAutofillProfile(const std::string& guid); // Initiates the request for all AutoFill profiles. The method // OnWebDataServiceRequestDone of |consumer| gets called when the request is // finished, with the profiles included in the argument |result|. The // consumer owns the profiles. - Handle GetAutoFillProfiles(WebDataServiceConsumer* consumer); + Handle GetAutofillProfiles(WebDataServiceConsumer* consumer); // Schedules a task to add credit card to the web database. void AddCreditCard(const CreditCard& credit_card); @@ -471,7 +471,7 @@ class WebDataService Handle GetCreditCards(WebDataServiceConsumer* consumer); // Removes AutoFill records from the database. - void RemoveAutoFillProfilesAndCreditCardsModifiedBetween( + void RemoveAutofillProfilesAndCreditCardsModifiedBetween( const base::Time& delete_begin, const base::Time& delete_end); @@ -599,15 +599,15 @@ class WebDataService GenericRequest2<base::Time, base::Time>* request); void RemoveFormValueForElementNameImpl( GenericRequest2<string16, string16>* request); - void AddAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request); - void UpdateAutoFillProfileImpl(GenericRequest<AutoFillProfile>* request); - void RemoveAutoFillProfileImpl(GenericRequest<std::string>* request); - void GetAutoFillProfilesImpl(WebDataRequest* request); + void AddAutofillProfileImpl(GenericRequest<AutofillProfile>* request); + void UpdateAutofillProfileImpl(GenericRequest<AutofillProfile>* request); + void RemoveAutofillProfileImpl(GenericRequest<std::string>* request); + void GetAutofillProfilesImpl(WebDataRequest* request); void AddCreditCardImpl(GenericRequest<CreditCard>* request); void UpdateCreditCardImpl(GenericRequest<CreditCard>* request); void RemoveCreditCardImpl(GenericRequest<std::string>* request); void GetCreditCardsImpl(WebDataRequest* request); - void RemoveAutoFillProfilesAndCreditCardsModifiedBetweenImpl( + void RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl( GenericRequest2<base::Time, base::Time>* request); // True once initialization has started. diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index e2f538f..90dc950 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -252,7 +252,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillRemoveMany) { } TEST_F(WebDataServiceAutofillTest, ProfileAdd) { - AutoFillProfile profile; + AutofillProfile profile; // Check that GUID-based notification was sent. const AutofillProfileChange expected_change( @@ -265,12 +265,12 @@ TEST_F(WebDataServiceAutofillTest, ProfileAdd) { Pointee(expected_change)))). WillOnce(SignalEvent(&done_event_)); - wds_->AddAutoFillProfile(profile); + wds_->AddAutofillProfile(profile); done_event_.TimedWait(test_timeout_); // Check that it was added. - AutofillWebDataServiceConsumer<std::vector<AutoFillProfile*> > consumer; - WebDataService::Handle handle = wds_->GetAutoFillProfiles(&consumer); + AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer; + WebDataService::Handle handle = wds_->GetAutofillProfiles(&consumer); MessageLoop::current()->Run(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); @@ -279,18 +279,18 @@ TEST_F(WebDataServiceAutofillTest, ProfileAdd) { } TEST_F(WebDataServiceAutofillTest, ProfileRemove) { - AutoFillProfile profile; + AutofillProfile profile; // Add a profile. EXPECT_CALL(*observer_helper_->observer(), Observe(_, _, _)). Times(1). WillOnce(SignalEvent(&done_event_)); - wds_->AddAutoFillProfile(profile); + wds_->AddAutofillProfile(profile); done_event_.TimedWait(test_timeout_); // Check that it was added. - AutofillWebDataServiceConsumer<std::vector<AutoFillProfile*> > consumer; - WebDataService::Handle handle = wds_->GetAutoFillProfiles(&consumer); + AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer; + WebDataService::Handle handle = wds_->GetAutofillProfiles(&consumer); MessageLoop::current()->Run(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); @@ -309,33 +309,33 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) { WillOnce(SignalEvent(&done_event_)); // Remove the profile. - wds_->RemoveAutoFillProfile(profile.guid()); + wds_->RemoveAutofillProfile(profile.guid()); done_event_.TimedWait(test_timeout_); // Check that it was removed. - AutofillWebDataServiceConsumer<std::vector<AutoFillProfile*> > consumer2; - WebDataService::Handle handle2 = wds_->GetAutoFillProfiles(&consumer2); + AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer2; + WebDataService::Handle handle2 = wds_->GetAutofillProfiles(&consumer2); MessageLoop::current()->Run(); EXPECT_EQ(handle2, consumer2.handle()); ASSERT_EQ(0U, consumer2.result().size()); } TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { - AutoFillProfile profile1; + AutofillProfile profile1; profile1.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Abe")); - AutoFillProfile profile2; + AutofillProfile profile2; profile2.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Alice")); EXPECT_CALL(*observer_helper_->observer(), Observe(_, _, _)). WillOnce(DoDefault()). WillOnce(SignalEvent(&done_event_)); - wds_->AddAutoFillProfile(profile1); - wds_->AddAutoFillProfile(profile2); + wds_->AddAutofillProfile(profile1); + wds_->AddAutofillProfile(profile2); done_event_.TimedWait(test_timeout_); // Check that they were added. - AutofillWebDataServiceConsumer<std::vector<AutoFillProfile*> > consumer; - WebDataService::Handle handle = wds_->GetAutoFillProfiles(&consumer); + AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer; + WebDataService::Handle handle = wds_->GetAutofillProfiles(&consumer); MessageLoop::current()->Run(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(2U, consumer.result().size()); @@ -343,7 +343,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { EXPECT_EQ(profile2, *consumer.result()[1]); STLDeleteElements(&consumer.result()); - AutoFillProfile profile1_changed(profile1); + AutofillProfile profile1_changed(profile1); profile1_changed.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Bill")); const AutofillProfileChange expected_change( AutofillProfileChange::UPDATE, profile1.guid(), &profile1_changed); @@ -357,12 +357,12 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { WillOnce(SignalEvent(&done_event_)); // Update the profile. - wds_->UpdateAutoFillProfile(profile1_changed); + wds_->UpdateAutofillProfile(profile1_changed); done_event_.TimedWait(test_timeout_); // Check that the updates were made. - AutofillWebDataServiceConsumer<std::vector<AutoFillProfile*> > consumer2; - WebDataService::Handle handle2 = wds_->GetAutoFillProfiles(&consumer2); + AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer2; + WebDataService::Handle handle2 = wds_->GetAutofillProfiles(&consumer2); MessageLoop::current()->Run(); EXPECT_EQ(handle2, consumer2.handle()); ASSERT_EQ(2U, consumer2.result().size()); diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index 735ac10..9d11629 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -280,7 +280,7 @@ string16 LimitDataSize(const string16& data) { return data; } -void BindAutoFillProfileToStatement(const AutoFillProfile& profile, +void BindAutofillProfileToStatement(const AutofillProfile& profile, sql::Statement* s) { DCHECK(guid::IsValidGUID(profile.guid())); s->BindString(0, profile.guid()); @@ -304,8 +304,8 @@ void BindAutoFillProfileToStatement(const AutoFillProfile& profile, s->BindInt64(9, Time::Now().ToTimeT()); } -AutoFillProfile* AutoFillProfileFromStatement(const sql::Statement& s) { - AutoFillProfile* profile = new AutoFillProfile; +AutofillProfile* AutofillProfileFromStatement(const sql::Statement& s) { + AutofillProfile* profile = new AutofillProfile; profile->set_guid(s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); @@ -322,8 +322,8 @@ AutoFillProfile* AutoFillProfileFromStatement(const sql::Statement& s) { return profile; } -void AddAutoFillProfileNameFromStatement(const sql::Statement& s, - AutoFillProfile* profile) { +void AddAutofillProfileNameFromStatement(const sql::Statement& s, + AutofillProfile* profile) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); @@ -332,24 +332,24 @@ void AddAutoFillProfileNameFromStatement(const sql::Statement& s, profile->SetInfo(AutofillType(NAME_LAST), s.ColumnString16(3)); } -void AddAutoFillProfileEmailFromStatement(const sql::Statement& s, - AutoFillProfile* profile) { +void AddAutofillProfileEmailFromStatement(const sql::Statement& s, + AutofillProfile* profile) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); profile->SetInfo(AutofillType(EMAIL_ADDRESS), s.ColumnString16(1)); } -void AddAutoFillProfilePhoneFromStatement(const sql::Statement& s, - AutoFillProfile* profile) { +void AddAutofillProfilePhoneFromStatement(const sql::Statement& s, + AutofillProfile* profile) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); DCHECK_EQ(kAutoFillPhoneNumber, s.ColumnInt(1)); profile->SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(2)); } -void AddAutoFillProfileFaxFromStatement(const sql::Statement& s, - AutoFillProfile* profile) { +void AddAutofillProfileFaxFromStatement(const sql::Statement& s, + AutofillProfile* profile) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); DCHECK_EQ(kAutoFillFaxNumber, s.ColumnInt(1)); @@ -400,16 +400,16 @@ CreditCard* CreditCardFromStatement(const sql::Statement& s) { return credit_card; } -bool AutoFillProfileHasName(const AutoFillProfile& profile) { +bool AutofillProfileHasName(const AutofillProfile& profile) { return !profile.GetFieldText(AutofillType(NAME_FIRST)).empty() || !profile.GetFieldText(AutofillType(NAME_MIDDLE)).empty() || !profile.GetFieldText(AutofillType(NAME_MIDDLE)).empty(); } -bool AddAutoFillProfileName(const std::string& guid, - const AutoFillProfile& profile, +bool AddAutofillProfileName(const std::string& guid, + const AutofillProfile& profile, sql::Connection* db) { - if (!AutoFillProfileHasName(profile)) + if (!AutofillProfileHasName(profile)) return true; // Check for duplicate. @@ -449,8 +449,8 @@ bool AddAutoFillProfileName(const std::string& guid, return true; } -bool AddAutoFillProfileEmail(const std::string& guid, - const AutoFillProfile& profile, +bool AddAutofillProfileEmail(const std::string& guid, + const AutofillProfile& profile, sql::Connection* db) { if (profile.GetFieldText(AutofillType(EMAIL_ADDRESS)).empty()) return true; @@ -487,8 +487,8 @@ bool AddAutoFillProfileEmail(const std::string& guid, return true; } -bool AddAutoFillProfilePhone(const std::string& guid, - const AutoFillProfile& profile, +bool AddAutofillProfilePhone(const std::string& guid, + const AutofillProfile& profile, AutoFillPhoneType phone_type, sql::Connection* db) { AutofillFieldType field_type; @@ -540,25 +540,25 @@ bool AddAutoFillProfilePhone(const std::string& guid, return true; } -bool AddAutoFillProfilePieces(const std::string& guid, - const AutoFillProfile& profile, +bool AddAutofillProfilePieces(const std::string& guid, + const AutofillProfile& profile, sql::Connection* db) { - if (!AddAutoFillProfileName(guid, profile, db)) + if (!AddAutofillProfileName(guid, profile, db)) return false; - if (!AddAutoFillProfileEmail(guid, profile, db)) + if (!AddAutofillProfileEmail(guid, profile, db)) return false; - if (!AddAutoFillProfilePhone(guid, profile, kAutoFillPhoneNumber, db)) + if (!AddAutofillProfilePhone(guid, profile, kAutoFillPhoneNumber, db)) return false; - if (!AddAutoFillProfilePhone(guid, profile, kAutoFillFaxNumber, db)) + if (!AddAutofillProfilePhone(guid, profile, kAutoFillFaxNumber, db)) return false; return true; } -bool RemoveAutoFillProfilePieces(const std::string& guid, sql::Connection* db) { +bool RemoveAutofillProfilePieces(const std::string& guid, sql::Connection* db) { sql::Statement s1(db->GetUniqueStatement( "DELETE FROM autofill_profile_names WHERE guid = ?")); if (!s1) { @@ -649,9 +649,9 @@ sql::InitStatus WebDatabase::Init(const FilePath& db_name) { // Initialize the tables. if (!InitKeywordsTable() || !InitLoginsTable() || !InitWebAppIconsTable() || !InitWebAppsTable() || !InitAutofillTable() || - !InitAutofillDatesTable() || !InitAutoFillProfilesTable() || - !InitAutoFillProfileNamesTable() || !InitAutoFillProfileEmailsTable() || - !InitAutoFillProfilePhonesTable() || !InitCreditCardsTable() || + !InitAutofillDatesTable() || !InitAutofillProfilesTable() || + !InitAutofillProfileNamesTable() || !InitAutofillProfileEmailsTable() || + !InitAutofillProfilePhonesTable() || !InitCreditCardsTable() || !InitTokenServiceTable()) { LOG(WARNING) << "Unable to initialize the web database."; return sql::INIT_FAILURE; @@ -938,7 +938,7 @@ bool WebDatabase::InitAutofillDatesTable() { return true; } -bool WebDatabase::InitAutoFillProfilesTable() { +bool WebDatabase::InitAutofillProfilesTable() { if (!db_.DoesTableExist("autofill_profiles")) { if (!db_.Execute("CREATE TABLE autofill_profiles ( " "guid VARCHAR PRIMARY KEY, " @@ -958,7 +958,7 @@ bool WebDatabase::InitAutoFillProfilesTable() { return true; } -bool WebDatabase::InitAutoFillProfileNamesTable() { +bool WebDatabase::InitAutofillProfileNamesTable() { if (!db_.DoesTableExist("autofill_profile_names")) { if (!db_.Execute("CREATE TABLE autofill_profile_names ( " "guid VARCHAR, " @@ -972,7 +972,7 @@ bool WebDatabase::InitAutoFillProfileNamesTable() { return true; } -bool WebDatabase::InitAutoFillProfileEmailsTable() { +bool WebDatabase::InitAutofillProfileEmailsTable() { if (!db_.DoesTableExist("autofill_profile_emails")) { if (!db_.Execute("CREATE TABLE autofill_profile_emails ( " "guid VARCHAR, " @@ -984,7 +984,7 @@ bool WebDatabase::InitAutoFillProfileEmailsTable() { return true; } -bool WebDatabase::InitAutoFillProfilePhonesTable() { +bool WebDatabase::InitAutofillProfilePhonesTable() { if (!db_.DoesTableExist("autofill_profile_phones")) { if (!db_.Execute("CREATE TABLE autofill_profile_phones ( " "guid VARCHAR, " @@ -1846,7 +1846,7 @@ bool WebDatabase::RemoveFormElement(const string16& name, return false; } -bool WebDatabase::AddAutoFillProfile(const AutoFillProfile& profile) { +bool WebDatabase::AddAutofillProfile(const AutofillProfile& profile) { sql::Statement s(db_.GetUniqueStatement( "INSERT INTO autofill_profiles" "(guid, company_name, address_line_1, address_line_2, city, state," @@ -1857,7 +1857,7 @@ bool WebDatabase::AddAutoFillProfile(const AutoFillProfile& profile) { return false; } - BindAutoFillProfileToStatement(profile, &s); + BindAutofillProfileToStatement(profile, &s); if (!s.Run()) { NOTREACHED(); @@ -1867,11 +1867,11 @@ bool WebDatabase::AddAutoFillProfile(const AutoFillProfile& profile) { if (!s.Succeeded()) return false; - return AddAutoFillProfilePieces(profile.guid(), profile, &db_); + return AddAutofillProfilePieces(profile.guid(), profile, &db_); } -bool WebDatabase::GetAutoFillProfile(const std::string& guid, - AutoFillProfile** profile) { +bool WebDatabase::GetAutofillProfile(const std::string& guid, + AutofillProfile** profile) { DCHECK(guid::IsValidGUID(guid)); DCHECK(profile); sql::Statement s(db_.GetUniqueStatement( @@ -1891,7 +1891,7 @@ bool WebDatabase::GetAutoFillProfile(const std::string& guid, if (!s.Succeeded()) return false; - scoped_ptr<AutoFillProfile> p(AutoFillProfileFromStatement(s)); + scoped_ptr<AutofillProfile> p(AutofillProfileFromStatement(s)); // Get associated name info. sql::Statement s2(db_.GetUniqueStatement( @@ -1905,7 +1905,7 @@ bool WebDatabase::GetAutoFillProfile(const std::string& guid, s2.BindString(0, guid); if (s2.Step()) { - AddAutoFillProfileNameFromStatement(s2, p.get()); + AddAutofillProfileNameFromStatement(s2, p.get()); } // Get associated email info. @@ -1920,7 +1920,7 @@ bool WebDatabase::GetAutoFillProfile(const std::string& guid, s3.BindString(0, guid); if (s3.Step()) { - AddAutoFillProfileEmailFromStatement(s3, p.get()); + AddAutofillProfileEmailFromStatement(s3, p.get()); } // Get associated phone info. @@ -1936,7 +1936,7 @@ bool WebDatabase::GetAutoFillProfile(const std::string& guid, s4.BindInt(1, kAutoFillPhoneNumber); if (s4.Step()) { - AddAutoFillProfilePhoneFromStatement(s4, p.get()); + AddAutofillProfilePhoneFromStatement(s4, p.get()); } // Get associated fax info. @@ -1952,15 +1952,15 @@ bool WebDatabase::GetAutoFillProfile(const std::string& guid, s5.BindInt(1, kAutoFillFaxNumber); if (s5.Step()) { - AddAutoFillProfileFaxFromStatement(s5, p.get()); + AddAutofillProfileFaxFromStatement(s5, p.get()); } *profile = p.release(); return true; } -bool WebDatabase::GetAutoFillProfiles( - std::vector<AutoFillProfile*>* profiles) { +bool WebDatabase::GetAutofillProfiles( + std::vector<AutofillProfile*>* profiles) { DCHECK(profiles); profiles->clear(); @@ -1974,8 +1974,8 @@ bool WebDatabase::GetAutoFillProfiles( while (s.Step()) { std::string guid = s.ColumnString(0); - AutoFillProfile* profile = NULL; - if (!GetAutoFillProfile(guid, &profile)) + AutofillProfile* profile = NULL; + if (!GetAutofillProfile(guid, &profile)) return false; profiles->push_back(profile); } @@ -1983,15 +1983,15 @@ bool WebDatabase::GetAutoFillProfiles( return s.Succeeded(); } -bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) { +bool WebDatabase::UpdateAutofillProfile(const AutofillProfile& profile) { DCHECK(guid::IsValidGUID(profile.guid())); - AutoFillProfile* tmp_profile = NULL; - if (!GetAutoFillProfile(profile.guid(), &tmp_profile)) + AutofillProfile* tmp_profile = NULL; + if (!GetAutofillProfile(profile.guid(), &tmp_profile)) return false; // Preserve appropriate modification dates by not updating unchanged profiles. - scoped_ptr<AutoFillProfile> old_profile(tmp_profile); + scoped_ptr<AutofillProfile> old_profile(tmp_profile); if (*old_profile == profile) return true; @@ -2006,7 +2006,7 @@ bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) { return false; } - BindAutoFillProfileToStatement(profile, &s); + BindAutofillProfileToStatement(profile, &s); s.BindString(10, profile.guid()); bool result = s.Run(); DCHECK_GT(db_.GetLastChangeCount(), 0); @@ -2014,13 +2014,13 @@ bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) { return result; // Remove the old names, emails, and phone/fax numbers. - if (!RemoveAutoFillProfilePieces(profile.guid(), &db_)) + if (!RemoveAutofillProfilePieces(profile.guid(), &db_)) return false; - return AddAutoFillProfilePieces(profile.guid(), profile, &db_); + return AddAutofillProfilePieces(profile.guid(), profile, &db_); } -bool WebDatabase::RemoveAutoFillProfile(const std::string& guid) { +bool WebDatabase::RemoveAutofillProfile(const std::string& guid) { DCHECK(guid::IsValidGUID(guid)); sql::Statement s(db_.GetUniqueStatement( "DELETE FROM autofill_profiles WHERE guid = ?")); @@ -2033,7 +2033,7 @@ bool WebDatabase::RemoveAutoFillProfile(const std::string& guid) { if (!s.Run()) return false; - return RemoveAutoFillProfilePieces(guid, &db_); + return RemoveAutofillProfilePieces(guid, &db_); } bool WebDatabase::AddCreditCard(const CreditCard& credit_card) { @@ -2146,7 +2146,7 @@ bool WebDatabase::RemoveCreditCard(const std::string& guid) { return s.Run(); } -bool WebDatabase::RemoveAutoFillProfilesAndCreditCardsModifiedBetween( +bool WebDatabase::RemoveAutofillProfilesAndCreditCardsModifiedBetween( base::Time delete_begin, base::Time delete_end) { DCHECK(delete_end.is_null() || delete_begin < delete_end); @@ -2678,7 +2678,7 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ // Add |guid| column to |autofill_profiles| table. // Note that we need to check for the guid column's existence due to the // fact that for a version 22 database the |autofill_profiles| table - // gets created fresh with |InitAutoFillProfilesTable|. + // gets created fresh with |InitAutofillProfilesTable|. if (!db_.DoesColumnExist("autofill_profiles", "guid")) { if (!db_.Execute("ALTER TABLE autofill_profiles ADD COLUMN " "guid VARCHAR NOT NULL DEFAULT \"\"")) { @@ -2722,7 +2722,7 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ // Add |guid| column to |credit_cards| table. // Note that we need to check for the guid column's existence due to the // fact that for a version 22 database the |autofill_profiles| table - // gets created fresh with |InitAutoFillProfilesTable|. + // gets created fresh with |InitAutofillProfilesTable|. if (!db_.DoesColumnExist("credit_cards", "guid")) { if (!db_.Execute("ALTER TABLE credit_cards ADD COLUMN " "guid VARCHAR NOT NULL DEFAULT \"\"")) { @@ -2891,7 +2891,7 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ "zipcode, country, phone, fax, date_modified " "FROM autofill_profiles")); while (s.Step()) { - AutoFillProfile profile; + AutofillProfile profile; profile.set_guid(s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile.guid())); @@ -2951,7 +2951,7 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ } // Add the other bits: names, emails, and phone/fax. - if (!AddAutoFillProfilePieces(profile.guid(), profile, &db_)) { + if (!AddAutofillProfilePieces(profile.guid(), profile, &db_)) { NOTREACHED(); return sql::INIT_FAILURE; } diff --git a/chrome/browser/webdata/web_database.h b/chrome/browser/webdata/web_database.h index 6aeca08..2b647a8 100644 --- a/chrome/browser/webdata/web_database.h +++ b/chrome/browser/webdata/web_database.h @@ -18,7 +18,7 @@ class AutofillChange; class AutofillEntry; -class AutoFillProfile; +class AutofillProfile; class CreditCard; class FilePath; class GURL; @@ -222,20 +222,20 @@ class WebDatabase { virtual bool UpdateAutofillEntries(const std::vector<AutofillEntry>& entries); // Records a single AutoFill profile in the autofill_profiles table. - virtual bool AddAutoFillProfile(const AutoFillProfile& profile); + virtual bool AddAutofillProfile(const AutofillProfile& profile); // Updates the database values for the specified profile. - virtual bool UpdateAutoFillProfile(const AutoFillProfile& profile); + virtual bool UpdateAutofillProfile(const AutofillProfile& profile); // Removes a row from the autofill_profiles table. |guid| is the identifier // of the profile to remove. - virtual bool RemoveAutoFillProfile(const std::string& guid); + virtual bool RemoveAutofillProfile(const std::string& guid); // Retrieves a profile with guid |guid|. The caller owns |profile|. - bool GetAutoFillProfile(const std::string& guid, AutoFillProfile** profile); + bool GetAutofillProfile(const std::string& guid, AutofillProfile** profile); // Retrieves all profiles in the database. Caller owns the returned profiles. - virtual bool GetAutoFillProfiles(std::vector<AutoFillProfile*>* profiles); + virtual bool GetAutofillProfiles(std::vector<AutofillProfile*>* profiles); // Records a single credit card in the credit_cards table. bool AddCreditCard(const CreditCard& credit_card); @@ -257,7 +257,7 @@ class WebDatabase { // Removes rows from autofill_profiles and credit_cards if they were created // on or after |delete_begin| and strictly before |delete_end|. - bool RemoveAutoFillProfilesAndCreditCardsModifiedBetween( + bool RemoveAutofillProfilesAndCreditCardsModifiedBetween( base::Time delete_begin, base::Time delete_end); @@ -307,12 +307,12 @@ class WebDatabase { Autofill_GetAllAutofillEntries_TwoSame); FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, Autofill_UpdateDontReplace); FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, Autofill_AddFormFieldValues); - FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, AutoFillProfile); + FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, AutofillProfile); FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, CreditCard); - FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateAutoFillProfile); + FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateAutofillProfile); FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateCreditCard); FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, - RemoveAutoFillProfilesAndCreditCardsModifiedBetween); + RemoveAutofillProfilesAndCreditCardsModifiedBetween); // Methods for adding autofill entries at a specified time. For // testing only. @@ -337,10 +337,10 @@ class WebDatabase { bool InitLoginsTable(); bool InitAutofillTable(); bool InitAutofillDatesTable(); - bool InitAutoFillProfilesTable(); - bool InitAutoFillProfileNamesTable(); - bool InitAutoFillProfileEmailsTable(); - bool InitAutoFillProfilePhonesTable(); + bool InitAutofillProfilesTable(); + bool InitAutofillProfileNamesTable(); + bool InitAutofillProfileEmailsTable(); + bool InitAutofillProfilePhonesTable(); bool InitCreditCardsTable(); bool InitTokenServiceTable(); bool InitWebAppIconsTable(); diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index 559f70b..c37f75c 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -94,8 +94,8 @@ bool CompareAutofillEntries(const AutofillEntry& a, const AutofillEntry& b) { return !timestamps2.empty(); } -void AutoFillProfile31FromStatement(const sql::Statement& s, - AutoFillProfile* profile, +void AutofillProfile31FromStatement(const sql::Statement& s, + AutofillProfile* profile, string16* label, int* unique_id, int64* date_modified) { @@ -123,8 +123,8 @@ void AutoFillProfile31FromStatement(const sql::Statement& s, EXPECT_TRUE(guid::IsValidGUID(profile->guid())); } -void AutoFillProfile32FromStatement(const sql::Statement& s, - AutoFillProfile* profile, +void AutofillProfile32FromStatement(const sql::Statement& s, + AutofillProfile* profile, string16* label, int64* date_modified) { DCHECK(profile); @@ -149,8 +149,8 @@ void AutoFillProfile32FromStatement(const sql::Statement& s, *date_modified = s.ColumnInt64(15); } -void AutoFillProfile33FromStatement(const sql::Statement& s, - AutoFillProfile* profile, +void AutofillProfile33FromStatement(const sql::Statement& s, + AutofillProfile* profile, int64* date_modified) { DCHECK(profile); DCHECK(date_modified); @@ -1401,13 +1401,13 @@ TEST_F(WebDatabaseTest, TokenServiceGetSet) { EXPECT_EQ(out_map.find(service)->second, "ham"); } -TEST_F(WebDatabaseTest, AutoFillProfile) { +TEST_F(WebDatabaseTest, AutofillProfile) { WebDatabase db; ASSERT_EQ(sql::INIT_OK, db.Init(file_)); // Add a 'Home' profile. - AutoFillProfile home_profile; + AutofillProfile home_profile; home_profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); home_profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); home_profile.SetInfo(AutofillType(NAME_LAST), ASCIIToUTF16("Smith")); @@ -1429,12 +1429,12 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { ASCIIToUTF16("1915243678")); Time pre_creation_time = Time::Now(); - EXPECT_TRUE(db.AddAutoFillProfile(home_profile)); + EXPECT_TRUE(db.AddAutofillProfile(home_profile)); Time post_creation_time = Time::Now(); // Get the 'Home' profile. - AutoFillProfile* db_profile; - ASSERT_TRUE(db.GetAutoFillProfile(home_profile.guid(), &db_profile)); + AutofillProfile* db_profile; + ASSERT_TRUE(db.GetAutofillProfile(home_profile.guid(), &db_profile)); EXPECT_EQ(home_profile, *db_profile); sql::Statement s_home(db.db_.GetUniqueStatement( "SELECT date_modified " @@ -1448,7 +1448,7 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { delete db_profile; // Add a 'Billing' profile. - AutoFillProfile billing_profile = home_profile; + AutofillProfile billing_profile = home_profile; billing_profile.set_guid(guid::GenerateGUID()); billing_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("5678 Bottom Street")); @@ -1456,11 +1456,11 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { ASCIIToUTF16("suite 3")); pre_creation_time = Time::Now(); - EXPECT_TRUE(db.AddAutoFillProfile(billing_profile)); + EXPECT_TRUE(db.AddAutofillProfile(billing_profile)); post_creation_time = Time::Now(); // Get the 'Billing' profile. - ASSERT_TRUE(db.GetAutoFillProfile(billing_profile.guid(), &db_profile)); + ASSERT_TRUE(db.GetAutofillProfile(billing_profile.guid(), &db_profile)); EXPECT_EQ(billing_profile, *db_profile); sql::Statement s_billing(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles WHERE guid=?")); @@ -1475,9 +1475,9 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { // Update the 'Billing' profile, name only. billing_profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Jane")); Time pre_modification_time = Time::Now(); - EXPECT_TRUE(db.UpdateAutoFillProfile(billing_profile)); + EXPECT_TRUE(db.UpdateAutofillProfile(billing_profile)); Time post_modification_time = Time::Now(); - ASSERT_TRUE(db.GetAutoFillProfile(billing_profile.guid(), &db_profile)); + ASSERT_TRUE(db.GetAutofillProfile(billing_profile.guid(), &db_profile)); EXPECT_EQ(billing_profile, *db_profile); sql::Statement s_billing_updated(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles WHERE guid=?")); @@ -1514,9 +1514,9 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { billing_profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1915240000")); Time pre_modification_time_2 = Time::Now(); - EXPECT_TRUE(db.UpdateAutoFillProfile(billing_profile)); + EXPECT_TRUE(db.UpdateAutofillProfile(billing_profile)); Time post_modification_time_2 = Time::Now(); - ASSERT_TRUE(db.GetAutoFillProfile(billing_profile.guid(), &db_profile)); + ASSERT_TRUE(db.GetAutofillProfile(billing_profile.guid(), &db_profile)); EXPECT_EQ(billing_profile, *db_profile); sql::Statement s_billing_updated_2(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles WHERE guid=?")); @@ -1531,8 +1531,8 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { delete db_profile; // Remove the 'Billing' profile. - EXPECT_TRUE(db.RemoveAutoFillProfile(billing_profile.guid())); - EXPECT_FALSE(db.GetAutoFillProfile(billing_profile.guid(), &db_profile)); + EXPECT_TRUE(db.RemoveAutofillProfile(billing_profile.guid())); + EXPECT_FALSE(db.GetAutofillProfile(billing_profile.guid(), &db_profile)); } TEST_F(WebDatabaseTest, CreditCard) { @@ -1624,12 +1624,12 @@ TEST_F(WebDatabaseTest, CreditCard) { EXPECT_FALSE(db.GetCreditCard(target_creditcard.guid(), &db_creditcard)); } -TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { +TEST_F(WebDatabaseTest, UpdateAutofillProfile) { WebDatabase db; ASSERT_EQ(sql::INIT_OK, db.Init(file_)); // Add a profile to the db. - AutoFillProfile profile; + AutofillProfile profile; profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); profile.SetInfo(AutofillType(NAME_LAST), ASCIIToUTF16("Smith")); @@ -1646,7 +1646,7 @@ TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { ASCIIToUTF16("18181234567")); profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1915243678")); - db.AddAutoFillProfile(profile); + db.AddAutofillProfile(profile); // Set a mocked value for the profile's creation time. const time_t mock_creation_date = Time::Now().ToTimeT() - 13; @@ -1657,9 +1657,9 @@ TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { ASSERT_TRUE(s_mock_creation_date.Run()); // Get the profile. - AutoFillProfile* tmp_profile; - ASSERT_TRUE(db.GetAutoFillProfile(profile.guid(), &tmp_profile)); - scoped_ptr<AutoFillProfile> db_profile(tmp_profile); + AutofillProfile* tmp_profile; + ASSERT_TRUE(db.GetAutofillProfile(profile.guid(), &tmp_profile)); + scoped_ptr<AutofillProfile> db_profile(tmp_profile); EXPECT_EQ(profile, *db_profile); sql::Statement s_original(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles")); @@ -1671,10 +1671,10 @@ TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { // Now, update the profile and save the update to the database. // The modification date should change to reflect the update. profile.SetInfo(AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("js@smith.xyz")); - db.UpdateAutoFillProfile(profile); + db.UpdateAutofillProfile(profile); // Get the profile. - ASSERT_TRUE(db.GetAutoFillProfile(profile.guid(), &tmp_profile)); + ASSERT_TRUE(db.GetAutofillProfile(profile.guid(), &tmp_profile)); db_profile.reset(tmp_profile); EXPECT_EQ(profile, *db_profile); sql::Statement s_updated(db.db_.GetUniqueStatement( @@ -1692,12 +1692,12 @@ TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { s_mock_modification_date.BindInt64(0, mock_modification_date); ASSERT_TRUE(s_mock_modification_date.Run()); - // Finally, call into |UpdateAutoFillProfile()| without changing the profile. + // Finally, call into |UpdateAutofillProfile()| without changing the profile. // The modification date should not change. - db.UpdateAutoFillProfile(profile); + db.UpdateAutofillProfile(profile); // Get the profile. - ASSERT_TRUE(db.GetAutoFillProfile(profile.guid(), &tmp_profile)); + ASSERT_TRUE(db.GetAutofillProfile(profile.guid(), &tmp_profile)); db_profile.reset(tmp_profile); EXPECT_EQ(profile, *db_profile); sql::Statement s_unchanged(db.db_.GetUniqueStatement( @@ -1784,7 +1784,7 @@ TEST_F(WebDatabaseTest, UpdateCreditCard) { EXPECT_FALSE(s_unchanged.Step()); } -TEST_F(WebDatabaseTest, RemoveAutoFillProfilesAndCreditCardsModifiedBetween) { +TEST_F(WebDatabaseTest, RemoveAutofillProfilesAndCreditCardsModifiedBetween) { WebDatabase db; ASSERT_EQ(sql::INIT_OK, db.Init(file_)); @@ -1816,7 +1816,7 @@ TEST_F(WebDatabaseTest, RemoveAutoFillProfilesAndCreditCardsModifiedBetween) { "VALUES('00000000-0000-0000-0000-000000000011', 67);")); // Remove all entries modified in the bounded time range [17,41). - db.RemoveAutoFillProfilesAndCreditCardsModifiedBetween( + db.RemoveAutofillProfilesAndCreditCardsModifiedBetween( base::Time::FromTimeT(17), base::Time::FromTimeT(41)); sql::Statement s_autofill_profiles_bounded(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles")); @@ -1842,7 +1842,7 @@ TEST_F(WebDatabaseTest, RemoveAutoFillProfilesAndCreditCardsModifiedBetween) { EXPECT_FALSE(s_credit_cards_bounded.Step()); // Remove all entries modified on or after time 51 (unbounded range). - db.RemoveAutoFillProfilesAndCreditCardsModifiedBetween( + db.RemoveAutofillProfilesAndCreditCardsModifiedBetween( base::Time::FromTimeT(51), base::Time()); sql::Statement s_autofill_profiles_unbounded(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles")); @@ -1860,7 +1860,7 @@ TEST_F(WebDatabaseTest, RemoveAutoFillProfilesAndCreditCardsModifiedBetween) { EXPECT_FALSE(s_credit_cards_unbounded.Step()); // Remove all remaining entries. - db.RemoveAutoFillProfilesAndCreditCardsModifiedBetween(base::Time(), + db.RemoveAutofillProfilesAndCreditCardsModifiedBetween(base::Time(), base::Time()); sql::Statement s_autofill_profiles_empty(db.db_.GetUniqueStatement( "SELECT date_modified FROM autofill_profiles")); @@ -2686,7 +2686,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { // Verify pre-conditions. These are expectations for version 30 of the // database. - AutoFillProfile profile; + AutofillProfile profile; string16 profile_label; int profile_unique_id = 0; int64 profile_date_modified = 0; @@ -2721,7 +2721,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { "zipcode, country, phone, fax, date_modified, guid " "FROM autofill_profiles")); ASSERT_TRUE(s1.Step()); - EXPECT_NO_FATAL_FAILURE(AutoFillProfile31FromStatement( + EXPECT_NO_FATAL_FAILURE(AutofillProfile31FromStatement( s1, &profile, &profile_label, &profile_unique_id, &profile_date_modified)); @@ -2783,9 +2783,9 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { "FROM autofill_profiles")); ASSERT_TRUE(s1.Step()); - AutoFillProfile profile_a; + AutofillProfile profile_a; int64 profile_date_modified_a = 0; - EXPECT_NO_FATAL_FAILURE(AutoFillProfile33FromStatement( + EXPECT_NO_FATAL_FAILURE(AutofillProfile33FromStatement( s1, &profile_a, &profile_date_modified_a)); EXPECT_EQ(profile.guid(), profile_a.guid()); EXPECT_EQ(profile.GetFieldText(AutofillType(COMPANY_NAME)), diff --git a/chrome/test/functional/autofill.py b/chrome/test/functional/autofill.py index f647612..d1667c8 100644 --- a/chrome/test/functional/autofill.py +++ b/chrome/test/functional/autofill.py @@ -24,7 +24,7 @@ class AutoFillTest(pyauto.PyUITest): pp = pprint.PrettyPrinter(indent=2) while True: raw_input('Hit <enter> to dump info.. ') - info = self.GetAutoFillProfile() + info = self.GetAutofillProfile() pp.pprint(info) def testFillProfile(self): @@ -38,14 +38,14 @@ class AutoFillTest(pyauto.PyUITest): 'CREDIT_CARD_EXP_4_DIGIT_YEAR': '2011'}, {'CREDIT_CARD_NAME': 'Bob C. Smith'}] - self.FillAutoFillProfile(profiles=profiles, credit_cards=credit_cards) - profile = self.GetAutoFillProfile() + self.FillAutofillProfile(profiles=profiles, credit_cards=credit_cards) + profile = self.GetAutofillProfile() self.assertEqual(profiles, profile['profiles']) self.assertEqual(credit_cards, profile['credit_cards']) profiles = [ {'NAME_FIRST': 'Larry'}] - self.FillAutoFillProfile(profiles=profiles) - profile = self.GetAutoFillProfile() + self.FillAutofillProfile(profiles=profiles) + profile = self.GetAutofillProfile() self.assertEqual(profiles, profile['profiles']) self.assertEqual(credit_cards, profile['credit_cards']) @@ -54,22 +54,22 @@ class AutoFillTest(pyauto.PyUITest): # Adding autofill profiles. file_path = os.path.join(self.DataDir(), 'autofill', 'crazy_autofill.txt') profiles = self.EvalDataFrom(file_path) - self.FillAutoFillProfile(profiles=profiles) + self.FillAutofillProfile(profiles=profiles) - self.assertEqual(profiles, self.GetAutoFillProfile()['profiles']) + self.assertEqual(profiles, self.GetAutofillProfile()['profiles']) # Adding credit cards. file_path = os.path.join(self.DataDir(), 'autofill', 'crazy_creditcards.txt') test_data = self.EvalDataFrom(file_path) credit_cards_input = test_data['input'] - self.FillAutoFillProfile(credit_cards=credit_cards_input) + self.FillAutofillProfile(credit_cards=credit_cards_input) self.assertEqual(test_data['expected'], - self.GetAutoFillProfile()['credit_cards']) + self.GetAutofillProfile()['credit_cards']) def testGetProfilesEmpty(self): """Test getting profiles when none have been filled.""" - profile = self.GetAutoFillProfile() + profile = self.GetAutofillProfile() self.assertEqual([], profile['profiles']) self.assertEqual([], profile['credit_cards']) @@ -85,16 +85,16 @@ class AutoFillTest(pyauto.PyUITest): with_invalid = without_invalid.copy() with_invalid['PHONE_HOME_WHOLE_NUMBER'] = 'Invalid_Phone_Number' with_invalid['PHONE_FAX_WHOLE_NUMBER'] = 'Invalid_Fax_Number' - self.FillAutoFillProfile(profiles=[with_invalid]) + self.FillAutofillProfile(profiles=[with_invalid]) self.assertEqual([without_invalid], - self.GetAutoFillProfile()['profiles']) + self.GetAutofillProfile()['profiles']) # Then try credit cards with invalid input. Should strip off all non-digits credit_card = {'CREDIT_CARD_NUMBER': 'Not_0123-5Checked'} expected_credit_card = {'CREDIT_CARD_NUMBER': '01235'} - self.FillAutoFillProfile(credit_cards=[credit_card]) + self.FillAutofillProfile(credit_cards=[credit_card]) self.assertEqual([expected_credit_card], - self.GetAutoFillProfile()['credit_cards']) + self.GetAutofillProfile()['credit_cards']) def testFilterIncompleteAddresses(self): """Test Autofill filters out profile with incomplete address info.""" @@ -117,7 +117,7 @@ class AutoFillTest(pyauto.PyUITest): }); """ self.ExecuteJavascript(js_code, 0, 0) - self.assertEqual([], self.GetAutoFillProfile()['profiles']) + self.assertEqual([], self.GetAutofillProfile()['profiles']) def testFilterMalformedEmailAddresses(self): """Test Autofill filters out malformed email address during form submit.""" @@ -144,7 +144,7 @@ class AutoFillTest(pyauto.PyUITest): }); """ self.ExecuteJavascript(js_code, 0, 0) - if 'EMAIL_ADDRESS' in self.GetAutoFillProfile()['profiles'][0]: + if 'EMAIL_ADDRESS' in self.GetAutofillProfile()['profiles'][0]: raise KeyError('TEST FAIL: Malformed email address is saved in profiles.') def AutofillCrowdsourcing(self): @@ -160,14 +160,14 @@ class AutoFillTest(pyauto.PyUITest): file_path = os.path.join(self.DataDir(), 'autofill', 'crowdsource_autofill.txt') profiles = self.EvalDataFrom(file_path) - self.FillAutoFillProfile(profiles=profiles) + self.FillAutofillProfile(profiles=profiles) # Autofill server captures 2.5% of the data posted. # Looping 1000 times is a safe minimum to exceed the server's threshold or # noise. for i in range(1000): - fname = self.GetAutoFillProfile()['profiles'][0]['NAME_FIRST'] - lname = self.GetAutoFillProfile()['profiles'][0]['NAME_LAST'] - email = self.GetAutoFillProfile()['profiles'][0]['EMAIL_ADDRESS'] + fname = self.GetAutofillProfile()['profiles'][0]['NAME_FIRST'] + lname = self.GetAutofillProfile()['profiles'][0]['NAME_LAST'] + email = self.GetAutofillProfile()['profiles'][0]['EMAIL_ADDRESS'] # Submit form to collect crowdsourcing data for Autofill. self.NavigateToURL(url, 0, 0) fname_field = ('document.getElementById("fn").value = "%s"; ' @@ -207,11 +207,11 @@ class AutoFillTest(pyauto.PyUITest): # Verify total number of inputted profiles is greater than the final number # of profiles after merging. self.assertTrue( - len(list_of_dict) > len(self.GetAutoFillProfile()['profiles'])) + len(list_of_dict) > len(self.GetAutofillProfile()['profiles'])) # Write profile dictionary to a file. merged_profile = os.path.join(self.DataDir(), 'autofill', 'merged-profiles.txt') - profile_dict = self.GetAutoFillProfile()['profiles'] + profile_dict = self.GetAutofillProfile()['profiles'] output = open(merged_profile, 'wb') pickle.dump(profile_dict, output) output.close() diff --git a/chrome/test/live_sync/live_autofill_sync_test.cc b/chrome/test/live_sync/live_autofill_sync_test.cc index 5a19755..9954be6 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.cc +++ b/chrome/test/live_sync/live_autofill_sync_test.cc @@ -75,8 +75,8 @@ class MockPersonalDataManagerObserver : public PersonalDataManager::Observer { } // namespace -AutoFillProfile CreateAutofillProfile(LiveAutofillSyncTest::ProfileType type) { - AutoFillProfile profile; +AutofillProfile CreateAutofillProfile(LiveAutofillSyncTest::ProfileType type) { + AutofillProfile profile; switch (type) { case LiveAutofillSyncTest::PROFILE_MARION: autofill_test::SetProfileInfoWithGuid(&profile, @@ -181,7 +181,7 @@ bool LiveAutofillSyncTest::KeysMatch(int profile_a, int profile_b) { } void LiveAutofillSyncTest::SetProfiles( - int profile, std::vector<AutoFillProfile>* autofill_profiles) { + int profile, std::vector<AutofillProfile>* autofill_profiles) { MockPersonalDataManagerObserver observer; EXPECT_CALL(observer, OnPersonalDataLoaded()). WillOnce(QuitUIMessageLoop()); @@ -193,9 +193,9 @@ void LiveAutofillSyncTest::SetProfiles( } void LiveAutofillSyncTest::AddProfile(int profile, - const AutoFillProfile& autofill_profile) { - const std::vector<AutoFillProfile*>& all_profiles = GetAllProfiles(profile); - std::vector<AutoFillProfile> autofill_profiles; + const AutofillProfile& autofill_profile) { + const std::vector<AutofillProfile*>& all_profiles = GetAllProfiles(profile); + std::vector<AutofillProfile> autofill_profiles; for (size_t i = 0; i < all_profiles.size(); ++i) autofill_profiles.push_back(*all_profiles[i]); autofill_profiles.push_back(autofill_profile); @@ -203,8 +203,8 @@ void LiveAutofillSyncTest::AddProfile(int profile, } void LiveAutofillSyncTest::RemoveProfile(int profile, const std::string& guid) { - const std::vector<AutoFillProfile*>& all_profiles = GetAllProfiles(profile); - std::vector<AutoFillProfile> autofill_profiles; + const std::vector<AutofillProfile*>& all_profiles = GetAllProfiles(profile); + std::vector<AutofillProfile> autofill_profiles; for (size_t i = 0; i < all_profiles.size(); ++i) { if (all_profiles[i]->guid() != guid) autofill_profiles.push_back(*all_profiles[i]); @@ -216,8 +216,8 @@ void LiveAutofillSyncTest::UpdateProfile(int profile, const std::string& guid, const AutofillType& type, const string16& value) { - const std::vector<AutoFillProfile*>& all_profiles = GetAllProfiles(profile); - std::vector<AutoFillProfile> profiles; + const std::vector<AutofillProfile*>& all_profiles = GetAllProfiles(profile); + std::vector<AutofillProfile> profiles; for (size_t i = 0; i < all_profiles.size(); ++i) { profiles.push_back(*all_profiles[i]); if (all_profiles[i]->guid() == guid) @@ -226,7 +226,7 @@ void LiveAutofillSyncTest::UpdateProfile(int profile, SetProfiles(profile, &profiles); } -const std::vector<AutoFillProfile*>& LiveAutofillSyncTest::GetAllProfiles( +const std::vector<AutofillProfile*>& LiveAutofillSyncTest::GetAllProfiles( int profile) { MockPersonalDataManagerObserver observer; EXPECT_CALL(observer, OnPersonalDataLoaded()). @@ -240,24 +240,24 @@ const std::vector<AutoFillProfile*>& LiveAutofillSyncTest::GetAllProfiles( } bool LiveAutofillSyncTest::ProfilesMatch(int profile_a, int profile_b) { - const std::vector<AutoFillProfile*>& autofill_profiles_a = + const std::vector<AutofillProfile*>& autofill_profiles_a = GetAllProfiles(profile_a); - std::map<std::string, AutoFillProfile> autofill_profiles_a_map; + std::map<std::string, AutofillProfile> autofill_profiles_a_map; for (size_t i = 0; i < autofill_profiles_a.size(); ++i) { - const AutoFillProfile* p = autofill_profiles_a[i]; + const AutofillProfile* p = autofill_profiles_a[i]; autofill_profiles_a_map[p->guid()] = *p; } - const std::vector<AutoFillProfile*>& autofill_profiles_b = + const std::vector<AutofillProfile*>& autofill_profiles_b = GetAllProfiles(profile_b); for (size_t i = 0; i < autofill_profiles_b.size(); ++i) { - const AutoFillProfile* p = autofill_profiles_b[i]; + const AutofillProfile* p = autofill_profiles_b[i]; if (!autofill_profiles_a_map.count(p->guid())) { VLOG(1) << "GUID " << p->guid() << " not found in profile " << profile_b << "."; return false; } - AutoFillProfile* expected_profile = &autofill_profiles_a_map[p->guid()]; + AutofillProfile* expected_profile = &autofill_profiles_a_map[p->guid()]; expected_profile->set_guid(p->guid()); if (*expected_profile != *p) { VLOG(1) << "Mismatch in profile with GUID " << p->guid() << "."; diff --git a/chrome/test/live_sync/live_autofill_sync_test.h b/chrome/test/live_sync/live_autofill_sync_test.h index 33d8fb5..69559d3 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.h +++ b/chrome/test/live_sync/live_autofill_sync_test.h @@ -15,7 +15,7 @@ class AutofillEntry; class AutofillKey; -class AutoFillProfile; +class AutofillProfile; class WebDataService; class LiveAutofillSyncTest : public LiveSyncTest { @@ -53,10 +53,10 @@ class LiveAutofillSyncTest : public LiveSyncTest { // Replaces the Autofill profiles in sync profile |profile| with // |autofill_profiles|. void SetProfiles( - int profile, std::vector<AutoFillProfile>* autofill_profiles); + int profile, std::vector<AutofillProfile>* autofill_profiles); // Adds the autofill profile |autofill_profile| to sync profile |profile|. - void AddProfile(int profile, const AutoFillProfile& autofill_profile); + void AddProfile(int profile, const AutofillProfile& autofill_profile); // Removes the autofill profile with guid |guid| from sync profile // |profile|. @@ -71,7 +71,7 @@ class LiveAutofillSyncTest : public LiveSyncTest { // Gets all the Autofill profiles in the PersonalDataManager of sync profile // |profile|. - const std::vector<AutoFillProfile*>& GetAllProfiles(int profile) + const std::vector<AutofillProfile*>& GetAllProfiles(int profile) WARN_UNUSED_RESULT; // Compares the Autofill profiles in the PersonalDataManagers of sync profiles @@ -82,7 +82,7 @@ class LiveAutofillSyncTest : public LiveSyncTest { DISALLOW_COPY_AND_ASSIGN(LiveAutofillSyncTest); }; -AutoFillProfile CreateAutofillProfile(LiveAutofillSyncTest::ProfileType type); +AutofillProfile CreateAutofillProfile(LiveAutofillSyncTest::ProfileType type); class TwoClientLiveAutofillSyncTest : public LiveAutofillSyncTest { public: diff --git a/chrome/test/live_sync/two_client_live_autofill_sync_test.cc b/chrome/test/live_sync/two_client_live_autofill_sync_test.cc index b462699..1b4ace4 100644 --- a/chrome/test/live_sync/two_client_live_autofill_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_autofill_sync_test.cc @@ -154,9 +154,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, AddDuplicateProfiles) { IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, SameProfileWithConflict) { ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; - AutoFillProfile profile0 = + AutofillProfile profile0 = CreateAutofillProfile(LiveAutofillSyncTest::PROFILE_HOMER); - AutoFillProfile profile1 = + AutofillProfile profile1 = CreateAutofillProfile(LiveAutofillSyncTest::PROFILE_HOMER); profile1.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1234567890")); diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index ca782be..e57df5d 100644 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -1262,13 +1262,13 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): tab_index=tab_index, window_index=window_index)['page_translated'], args=[tab_index, window_index]) - def FillAutoFillProfile(self, profiles=None, credit_cards=None, + def FillAutofillProfile(self, profiles=None, credit_cards=None, tab_index=0, window_index=0): """Set the autofill profile to contain the given profiles and credit cards. If profiles or credit_cards are specified, they will overwrite existing profiles and credit cards. To update profiles and credit cards, get the - existing ones with the GetAutoFillProfile function and then append new + existing ones with the GetAutofillProfile function and then append new profiles to the list and call this function. Args: @@ -1321,19 +1321,19 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): pyauto_errors.JSONInterfaceError if the automation call returns an error. """ cmd_dict = { # Prepare command for the json interface - 'command': 'FillAutoFillProfile', + 'command': 'FillAutofillProfile', 'tab_index': tab_index, 'profiles': profiles, 'credit_cards': credit_cards } self._GetResultFromJSONRequest(cmd_dict, windex=window_index) - def GetAutoFillProfile(self, tab_index=0, window_index=0): + def GetAutofillProfile(self, tab_index=0, window_index=0): """Return the profile including all profiles and credit cards currently saved as a list of dictionaries. The format of the returned dictionary is described above in - FillAutoFillProfile. The general format is: + FillAutofillProfile. The general format is: {'profiles': [list of profile dictionaries as described above], 'credit_cards': [list of credit card dictionaries as described above]} @@ -1345,7 +1345,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): pyauto_errors.JSONInterfaceError if the automation call returns an error. """ cmd_dict = { # Prepare command for the json interface - 'command': 'GetAutoFillProfile', + 'command': 'GetAutofillProfile', 'tab_index': tab_index } return self._GetResultFromJSONRequest(cmd_dict, windex=window_index) |