| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 text = profile.GetRawInfo(ADDRESS_HOME_LINE1); | 65 text = profile.GetRawInfo(ADDRESS_HOME_LINE1); |
| 66 s->BindString16(2, LimitDataSize(text)); | 66 s->BindString16(2, LimitDataSize(text)); |
| 67 text = profile.GetRawInfo(ADDRESS_HOME_LINE2); | 67 text = profile.GetRawInfo(ADDRESS_HOME_LINE2); |
| 68 s->BindString16(3, LimitDataSize(text)); | 68 s->BindString16(3, LimitDataSize(text)); |
| 69 text = profile.GetRawInfo(ADDRESS_HOME_CITY); | 69 text = profile.GetRawInfo(ADDRESS_HOME_CITY); |
| 70 s->BindString16(4, LimitDataSize(text)); | 70 s->BindString16(4, LimitDataSize(text)); |
| 71 text = profile.GetRawInfo(ADDRESS_HOME_STATE); | 71 text = profile.GetRawInfo(ADDRESS_HOME_STATE); |
| 72 s->BindString16(5, LimitDataSize(text)); | 72 s->BindString16(5, LimitDataSize(text)); |
| 73 text = profile.GetRawInfo(ADDRESS_HOME_ZIP); | 73 text = profile.GetRawInfo(ADDRESS_HOME_ZIP); |
| 74 s->BindString16(6, LimitDataSize(text)); | 74 s->BindString16(6, LimitDataSize(text)); |
| 75 text = profile.GetInfo(ADDRESS_HOME_COUNTRY, app_locale); | 75 text = profile.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), app_locale); |
| 76 s->BindString16(7, LimitDataSize(text)); | 76 s->BindString16(7, LimitDataSize(text)); |
| 77 text = profile.GetRawInfo(ADDRESS_HOME_COUNTRY); | 77 text = profile.GetRawInfo(ADDRESS_HOME_COUNTRY); |
| 78 s->BindString16(8, LimitDataSize(text)); | 78 s->BindString16(8, LimitDataSize(text)); |
| 79 s->BindInt64(9, Time::Now().ToTimeT()); | 79 s->BindInt64(9, Time::Now().ToTimeT()); |
| 80 s->BindString(10, profile.origin()); | 80 s->BindString(10, profile.origin()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 AutofillProfile* AutofillProfileFromStatement(const sql::Statement& s, | 83 AutofillProfile* AutofillProfileFromStatement(const sql::Statement& s, |
| 84 const std::string& app_locale) { | 84 const std::string& app_locale) { |
| 85 AutofillProfile* profile = new AutofillProfile; | 85 AutofillProfile* profile = new AutofillProfile; |
| (...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 profile.SetRawInfo(NAME_FIRST, s.ColumnString16(1)); | 1921 profile.SetRawInfo(NAME_FIRST, s.ColumnString16(1)); |
| 1922 profile.SetRawInfo(NAME_MIDDLE, s.ColumnString16(2)); | 1922 profile.SetRawInfo(NAME_MIDDLE, s.ColumnString16(2)); |
| 1923 profile.SetRawInfo(NAME_LAST, s.ColumnString16(3)); | 1923 profile.SetRawInfo(NAME_LAST, s.ColumnString16(3)); |
| 1924 profile.SetRawInfo(EMAIL_ADDRESS, s.ColumnString16(4)); | 1924 profile.SetRawInfo(EMAIL_ADDRESS, s.ColumnString16(4)); |
| 1925 profile.SetRawInfo(COMPANY_NAME, s.ColumnString16(5)); | 1925 profile.SetRawInfo(COMPANY_NAME, s.ColumnString16(5)); |
| 1926 profile.SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(6)); | 1926 profile.SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(6)); |
| 1927 profile.SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(7)); | 1927 profile.SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(7)); |
| 1928 profile.SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(8)); | 1928 profile.SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(8)); |
| 1929 profile.SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(9)); | 1929 profile.SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(9)); |
| 1930 profile.SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(10)); | 1930 profile.SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(10)); |
| 1931 profile.SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(11), app_locale_); | 1931 profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(11), |
| 1932 app_locale_); |
| 1932 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(12)); | 1933 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(12)); |
| 1933 int64 date_modified = s.ColumnInt64(13); | 1934 int64 date_modified = s.ColumnInt64(13); |
| 1934 | 1935 |
| 1935 sql::Statement s_insert(db_->GetUniqueStatement( | 1936 sql::Statement s_insert(db_->GetUniqueStatement( |
| 1936 "INSERT INTO autofill_profiles_temp" | 1937 "INSERT INTO autofill_profiles_temp" |
| 1937 "(guid, company_name, address_line_1, address_line_2, city," | 1938 "(guid, company_name, address_line_1, address_line_2, city," |
| 1938 " state, zipcode, country, date_modified)" | 1939 " state, zipcode, country, date_modified)" |
| 1939 "VALUES (?,?,?,?,?,?,?,?,?)")); | 1940 "VALUES (?,?,?,?,?,?,?,?,?)")); |
| 1940 s_insert.BindString(0, profile.guid()); | 1941 s_insert.BindString(0, profile.guid()); |
| 1941 s_insert.BindString16(1, profile.GetRawInfo(COMPANY_NAME)); | 1942 s_insert.BindString16(1, profile.GetRawInfo(COMPANY_NAME)); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 text = iter->GetRawInfo(ADDRESS_HOME_LINE1); | 2145 text = iter->GetRawInfo(ADDRESS_HOME_LINE1); |
| 2145 s.BindString16(2, LimitDataSize(text)); | 2146 s.BindString16(2, LimitDataSize(text)); |
| 2146 text = iter->GetRawInfo(ADDRESS_HOME_LINE2); | 2147 text = iter->GetRawInfo(ADDRESS_HOME_LINE2); |
| 2147 s.BindString16(3, LimitDataSize(text)); | 2148 s.BindString16(3, LimitDataSize(text)); |
| 2148 text = iter->GetRawInfo(ADDRESS_HOME_CITY); | 2149 text = iter->GetRawInfo(ADDRESS_HOME_CITY); |
| 2149 s.BindString16(4, LimitDataSize(text)); | 2150 s.BindString16(4, LimitDataSize(text)); |
| 2150 text = iter->GetRawInfo(ADDRESS_HOME_STATE); | 2151 text = iter->GetRawInfo(ADDRESS_HOME_STATE); |
| 2151 s.BindString16(5, LimitDataSize(text)); | 2152 s.BindString16(5, LimitDataSize(text)); |
| 2152 text = iter->GetRawInfo(ADDRESS_HOME_ZIP); | 2153 text = iter->GetRawInfo(ADDRESS_HOME_ZIP); |
| 2153 s.BindString16(6, LimitDataSize(text)); | 2154 s.BindString16(6, LimitDataSize(text)); |
| 2154 text = iter->GetInfo(ADDRESS_HOME_COUNTRY, app_locale_); | 2155 text = iter->GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), app_locale_); |
| 2155 s.BindString16(7, LimitDataSize(text)); | 2156 s.BindString16(7, LimitDataSize(text)); |
| 2156 text = iter->GetRawInfo(ADDRESS_HOME_COUNTRY); | 2157 text = iter->GetRawInfo(ADDRESS_HOME_COUNTRY); |
| 2157 s.BindString16(8, LimitDataSize(text)); | 2158 s.BindString16(8, LimitDataSize(text)); |
| 2158 s.BindInt64(9, date_item->second); | 2159 s.BindInt64(9, date_item->second); |
| 2159 | 2160 |
| 2160 if (!s.Run()) | 2161 if (!s.Run()) |
| 2161 return false; | 2162 return false; |
| 2162 | 2163 |
| 2163 if (!AddAutofillProfilePieces(*iter, db_)) | 2164 if (!AddAutofillProfilePieces(*iter, db_)) |
| 2164 return false; | 2165 return false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2183 if (!db_->DoesColumnExist("credit_cards", "origin") && | 2184 if (!db_->DoesColumnExist("credit_cards", "origin") && |
| 2184 !db_->Execute("ALTER TABLE credit_cards " | 2185 !db_->Execute("ALTER TABLE credit_cards " |
| 2185 "ADD COLUMN origin VARCHAR DEFAULT ''")) { | 2186 "ADD COLUMN origin VARCHAR DEFAULT ''")) { |
| 2186 return false; | 2187 return false; |
| 2187 } | 2188 } |
| 2188 | 2189 |
| 2189 return transaction.Commit(); | 2190 return transaction.Commit(); |
| 2190 } | 2191 } |
| 2191 | 2192 |
| 2192 } // namespace autofill | 2193 } // namespace autofill |
| OLD | NEW |