Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/core/browser/webdata/autofill_table.h" | 5 #include "components/autofill/core/browser/webdata/autofill_table.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 "language_code " | 946 "language_code " |
| 947 "FROM server_addresses addresses " | 947 "FROM server_addresses addresses " |
| 948 "LEFT OUTER JOIN server_address_metadata USING (id)")); | 948 "LEFT OUTER JOIN server_address_metadata USING (id)")); |
| 949 | 949 |
| 950 while (s.Step()) { | 950 while (s.Step()) { |
| 951 int index = 0; | 951 int index = 0; |
| 952 std::unique_ptr<AutofillProfile> profile(new AutofillProfile( | 952 std::unique_ptr<AutofillProfile> profile(new AutofillProfile( |
| 953 AutofillProfile::SERVER_PROFILE, s.ColumnString(index++))); | 953 AutofillProfile::SERVER_PROFILE, s.ColumnString(index++))); |
| 954 profile->set_use_count(s.ColumnInt64(index++)); | 954 profile->set_use_count(s.ColumnInt64(index++)); |
| 955 profile->set_use_date(Time::FromInternalValue(s.ColumnInt64(index++))); | 955 profile->set_use_date(Time::FromInternalValue(s.ColumnInt64(index++))); |
| 956 profile->set_modification_date(Time()); | |
|
Mathieu
2016/05/25 20:28:46
comment? It's easy to miss the subtlety here and b
Justin Donnelly
2016/05/25 20:36:50
Done.
| |
| 956 | 957 |
| 957 base::string16 recipient_name = s.ColumnString16(index++); | 958 base::string16 recipient_name = s.ColumnString16(index++); |
| 958 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(index++)); | 959 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(index++)); |
| 959 profile->SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, s.ColumnString16(index++)); | 960 profile->SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, s.ColumnString16(index++)); |
| 960 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(index++)); | 961 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(index++)); |
| 961 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(index++)); | 962 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(index++)); |
| 962 profile->SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, | 963 profile->SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, |
| 963 s.ColumnString16(index++)); | 964 s.ColumnString16(index++)); |
| 964 index++; // Skip address_4 which we haven't added to AutofillProfile yet. | 965 index++; // Skip address_4 which we haven't added to AutofillProfile yet. |
| 965 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(index++)); | 966 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(index++)); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1212 CreditCard::FULL_SERVER_CARD; | 1213 CreditCard::FULL_SERVER_CARD; |
| 1213 std::string server_id = s.ColumnString(index++); | 1214 std::string server_id = s.ColumnString(index++); |
| 1214 | 1215 |
| 1215 CreditCard* card = new CreditCard(record_type, server_id); | 1216 CreditCard* card = new CreditCard(record_type, server_id); |
| 1216 card->SetRawInfo( | 1217 card->SetRawInfo( |
| 1217 CREDIT_CARD_NUMBER, | 1218 CREDIT_CARD_NUMBER, |
| 1218 record_type == CreditCard::MASKED_SERVER_CARD ? last_four | 1219 record_type == CreditCard::MASKED_SERVER_CARD ? last_four |
| 1219 : full_card_number); | 1220 : full_card_number); |
| 1220 card->set_use_count(s.ColumnInt64(index++)); | 1221 card->set_use_count(s.ColumnInt64(index++)); |
| 1221 card->set_use_date(Time::FromInternalValue(s.ColumnInt64(index++))); | 1222 card->set_use_date(Time::FromInternalValue(s.ColumnInt64(index++))); |
| 1223 card->set_modification_date(Time()); | |
| 1222 | 1224 |
| 1223 std::string card_type = s.ColumnString(index++); | 1225 std::string card_type = s.ColumnString(index++); |
| 1224 if (record_type == CreditCard::MASKED_SERVER_CARD) { | 1226 if (record_type == CreditCard::MASKED_SERVER_CARD) { |
| 1225 // The type must be set after setting the number to override the | 1227 // The type must be set after setting the number to override the |
| 1226 // autodectected type. | 1228 // autodectected type. |
| 1227 card->SetTypeForMaskedCard(card_type.c_str()); | 1229 card->SetTypeForMaskedCard(card_type.c_str()); |
| 1228 } else { | 1230 } else { |
| 1229 DCHECK_EQ(CreditCard::GetCreditCardType(full_card_number), card_type); | 1231 DCHECK_EQ(CreditCard::GetCreditCardType(full_card_number), card_type); |
| 1230 } | 1232 } |
| 1231 | 1233 |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2256 insert.BindString16(index++, profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); | 2258 insert.BindString16(index++, profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); |
| 2257 insert.BindString(index++, profile.language_code()); | 2259 insert.BindString(index++, profile.language_code()); |
| 2258 insert.Run(); | 2260 insert.Run(); |
| 2259 insert.Reset(true); | 2261 insert.Reset(true); |
| 2260 } | 2262 } |
| 2261 | 2263 |
| 2262 return transaction.Commit(); | 2264 return transaction.Commit(); |
| 2263 } | 2265 } |
| 2264 | 2266 |
| 2265 } // namespace autofill | 2267 } // namespace autofill |
| OLD | NEW |