summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 19:45:04 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 19:45:04 +0000
commite43783403ec799f226d7b6d9dde5ecd363f0b339 (patch)
treeea812df19a608f589ae53760a4ee5c63b6cdd101 /chrome/browser/views
parent206167f1286d23440b8fa60dfd2bf1a8e0036ce8 (diff)
downloadchromium_src-e43783403ec799f226d7b6d9dde5ecd363f0b339.zip
chromium_src-e43783403ec799f226d7b6d9dde5ecd363f0b339.tar.gz
chromium_src-e43783403ec799f226d7b6d9dde5ecd363f0b339.tar.bz2
Autofill deprecate unique_ids in favor of guids for PersonalDataManager
Final round of unique_id deprecation. These changes migrated web_database schemas for profiles and credit cards, clean up the web_dataservice interface, bring the personal_data_manager interface inline with the GUID interfaces for web_dataservice, convert remaining unit tests to be GUID-based, and some changes to platform UI code that used unique IDs for edits. BUG=58813 TEST=WebDataServiceTest.*, WebDatabaseTest.*, WebDatabaseMigrationTest.*, PersonalDataManagerTest.*, AutoFillTest.*, AutoFillDialogControllerTest.AddNewProfile, AutoFillDialogControllerTest.AddNewCreditCard, AutoFillProfileTest.MergeWith, ProfileSyncServiceAutofillTest.*, TwoClientLiveAutofillSyncTest.* Review URL: http://codereview.chromium.org/4388001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.cc34
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.h6
2 files changed, 8 insertions, 32 deletions
diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/views/autofill_profiles_view_win.cc
index 488ec72..414e0ba 100644
--- a/chrome/browser/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/views/autofill_profiles_view_win.cc
@@ -56,28 +56,6 @@ const int kDialogPadding = 7;
const int kSubViewHorizotalInsets = 18;
const int kSubViewVerticalInsets = 5;
-// This is a helper to compare items that were just created with items returned
-// from the db.
-// ProfileType could be either AutofillProfile or CreditCard.
-// The second argument could have an incomplete ID (0) - change it to first
-// argument's id for comparison and then change it back.
-template<class ProfileType> bool IsEqualDataWithIncompleteId(
- ProfileType const * data_to_compare, ProfileType* data_with_incomplete_id) {
- if (!data_with_incomplete_id->unique_id()) {
- bool label_unset = data_with_incomplete_id->Label().empty();
- if (label_unset)
- data_with_incomplete_id->set_label(data_to_compare->Label());
- data_with_incomplete_id->set_unique_id(data_to_compare->unique_id());
- bool are_equal = (*data_to_compare == *data_with_incomplete_id);
- data_with_incomplete_id->set_unique_id(0);
- if (label_unset)
- data_with_incomplete_id->set_label(string16());
- return are_equal;
- } else {
- return (*data_to_compare == *data_with_incomplete_id);
- }
-}
-
}; // namespace
/////////////////////////////////////////////////////////////////////////////
@@ -155,10 +133,10 @@ void AutoFillProfilesView::AddClicked(int group_type) {
std::vector<EditableSetInfo>::iterator it = profiles_set_.end();
int added_item_index = -1;
if (group_type == ContentListTableModel::kAddressGroup) {
- AutoFillProfile address(std::wstring(), 0);
+ AutoFillProfile address;
info.reset(new EditableSetInfo(&address));
} else if (group_type == ContentListTableModel::kCreditCardGroup) {
- CreditCard credit_card(std::wstring(), 0);
+ CreditCard credit_card;
info.reset(new EditableSetInfo(&credit_card));
} else {
NOTREACHED();
@@ -214,18 +192,16 @@ void AutoFillProfilesView::EditAccepted(EditableSetInfo* data,
std::vector<EditableSetInfo>::iterator end_it;
end_it = data->is_address ? profiles_set_.end() : credit_card_set_.end();
for (; it != end_it; ++it) {
- if (it->unique_id() == data->unique_id()) {
+ if (it->guid() == data->guid()) {
*it = *data;
break;
}
if (new_item) {
if (data->is_address) {
- if (IsEqualDataWithIncompleteId<AutoFillProfile>(&it->address,
- &data->address))
+ if (it->address.Compare(data->address) == 0)
break;
} else {
- if (IsEqualDataWithIncompleteId<CreditCard>(&it->credit_card,
- &data->credit_card))
+ if (it->credit_card.Compare(data->credit_card) == 0)
break;
}
}
diff --git a/chrome/browser/views/autofill_profiles_view_win.h b/chrome/browser/views/autofill_profiles_view_win.h
index 7ccfa63..efeaf59 100644
--- a/chrome/browser/views/autofill_profiles_view_win.h
+++ b/chrome/browser/views/autofill_profiles_view_win.h
@@ -166,11 +166,11 @@ class AutoFillProfilesView : public views::View,
is_address(false) {
}
- int unique_id() const {
+ std::string guid() const {
if (is_address)
- return address.unique_id();
+ return address.guid();
else
- return credit_card.unique_id();
+ return credit_card.guid();
}
};