| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/webdata/autofill_table.h" | 5 #include "chrome/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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/i18n/case_conversion.h" | 15 #include "base/i18n/case_conversion.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/stl_util.h" |
| 16 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 17 #include "base/time.h" | 19 #include "base/time.h" |
| 18 #include "base/tuple.h" | 20 #include "base/tuple.h" |
| 19 #include "chrome/browser/autofill/autofill_country.h" | 21 #include "chrome/browser/autofill/autofill_country.h" |
| 20 #include "chrome/browser/autofill/autofill_profile.h" | 22 #include "chrome/browser/autofill/autofill_profile.h" |
| 21 #include "chrome/browser/autofill/autofill_type.h" | 23 #include "chrome/browser/autofill/autofill_type.h" |
| 22 #include "chrome/browser/autofill/credit_card.h" | 24 #include "chrome/browser/autofill/credit_card.h" |
| 23 #include "chrome/browser/autofill/personal_data_manager.h" | 25 #include "chrome/browser/autofill/personal_data_manager.h" |
| 24 #include "chrome/browser/password_manager/encryptor.h" | 26 #include "chrome/browser/password_manager/encryptor.h" |
| 25 #include "chrome/browser/webdata/autofill_change.h" | 27 #include "chrome/browser/webdata/autofill_change.h" |
| 26 #include "chrome/browser/webdata/autofill_entry.h" | 28 #include "chrome/browser/webdata/autofill_entry.h" |
| 27 #include "chrome/common/guid.h" | 29 #include "chrome/common/guid.h" |
| 28 #include "sql/statement.h" | 30 #include "sql/statement.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "webkit/forms/form_field.h" | 32 #include "webkit/forms/form_field.h" |
| 31 | 33 |
| 32 using base::Time; | 34 using base::Time; |
| 33 using webkit::forms::FormField; | 35 using webkit::forms::FormField; |
| 34 | 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 typedef std::vector<Tuple3<int64, string16, string16> > AutofillElementList; | 39 typedef std::vector<Tuple3<int64, string16, string16> > AutofillElementList; |
| 38 | 40 |
| 39 // TODO(dhollowa): Find a common place for this. It is duplicated in | |
| 40 // personal_data_manager.cc. | |
| 41 template<typename T> | |
| 42 T* address_of(T& v) { | |
| 43 return &v; | |
| 44 } | |
| 45 | |
| 46 string16 LimitDataSize(const string16& data) { | 41 string16 LimitDataSize(const string16& data) { |
| 47 if (data.size() > AutofillTable::kMaxDataLength) | 42 if (data.size() > AutofillTable::kMaxDataLength) |
| 48 return data.substr(0, AutofillTable::kMaxDataLength); | 43 return data.substr(0, AutofillTable::kMaxDataLength); |
| 49 | 44 |
| 50 return data; | 45 return data; |
| 51 } | 46 } |
| 52 | 47 |
| 53 void BindAutofillProfileToStatement(const AutofillProfile& profile, | 48 void BindAutofillProfileToStatement(const AutofillProfile& profile, |
| 54 sql::Statement* s) { | 49 sql::Statement* s) { |
| 55 DCHECK(guid::IsValidGUID(profile.guid())); | 50 DCHECK(guid::IsValidGUID(profile.guid())); |
| (...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 "WHERE guid=?")); | 1973 "WHERE guid=?")); |
| 1979 s_date.BindInt64(0, date_item->second); | 1974 s_date.BindInt64(0, date_item->second); |
| 1980 s_date.BindString(1, iter->guid()); | 1975 s_date.BindString(1, iter->guid()); |
| 1981 | 1976 |
| 1982 if (!s_date.Run()) | 1977 if (!s_date.Run()) |
| 1983 return false; | 1978 return false; |
| 1984 } | 1979 } |
| 1985 | 1980 |
| 1986 return true; | 1981 return true; |
| 1987 } | 1982 } |
| OLD | NEW |