Chromium Code Reviews| Index: chrome/browser/webdata/web_database.cc |
| diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc |
| index 2b9c0298cdabe8ba21f7536daf3ac9f36dcf21aa..c4776e61d131497f4ac27e7b0a5610cd4aa7fb0a 100644 |
| --- a/chrome/browser/webdata/web_database.cc |
| +++ b/chrome/browser/webdata/web_database.cc |
| @@ -1693,6 +1693,14 @@ bool WebDatabase::GetAutoFillProfiles( |
| bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) { |
| DCHECK(guid::IsValidGUID(profile.guid())); |
| + |
| + // Preserve appropriate modification dates by not updating unchanged profiles. |
| + AutoFillProfile* tmp_profile; |
|
dhollowa
2010/12/03 16:02:21
Please initialize this to NULL. If the DCHECK fai
Ilya Sherman
2010/12/04 01:47:12
Done.
|
| + DCHECK(GetAutoFillProfileForGUID(profile.guid(), &tmp_profile)); |
| + scoped_ptr<AutoFillProfile> old_profile(tmp_profile); |
| + if ((*old_profile) == profile) |
|
dhollowa
2010/12/03 16:02:21
Are the extra parens necessary?
Ilya Sherman
2010/12/04 01:47:12
Nah. It's never been clear to me what the style e
|
| + return true; |
| + |
| sql::Statement s(db_.GetUniqueStatement( |
| "UPDATE autofill_profiles " |
| "SET guid=?, label=?, first_name=?, middle_name=?, last_name=?, " |
| @@ -1813,6 +1821,14 @@ bool WebDatabase::GetCreditCards( |
| bool WebDatabase::UpdateCreditCard(const CreditCard& credit_card) { |
| DCHECK(guid::IsValidGUID(credit_card.guid())); |
| + |
| + // Preserve appropriate modification dates by not updating unchanged cards. |
| + CreditCard* tmp_credit_card; |
| + DCHECK(GetCreditCardForGUID(credit_card.guid(), &tmp_credit_card)); |
| + scoped_ptr<CreditCard> old_credit_card(tmp_credit_card); |
| + if ((*old_credit_card) == credit_card) |
| + return true; |
| + |
| sql::Statement s(db_.GetUniqueStatement( |
| "UPDATE credit_cards " |
| "SET guid=?, label=?, name_on_card=?, expiration_month=?, " |