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 "components/webdata/autofill/autofill_table.h" | 5 #include "components/webdata/autofill/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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 WebDatabaseTable::TypeKey GetKey() { | 325 WebDatabaseTable::TypeKey GetKey() { |
326 return reinterpret_cast<void*>(&table_key); | 326 return reinterpret_cast<void*>(&table_key); |
327 } | 327 } |
328 | 328 |
329 } // namespace | 329 } // namespace |
330 | 330 |
331 // The maximum length allowed for form data. | 331 // The maximum length allowed for form data. |
332 const size_t AutofillTable::kMaxDataLength = 1024; | 332 const size_t AutofillTable::kMaxDataLength = 1024; |
333 | 333 |
334 AutofillTable::AutofillTable() | 334 AutofillTable::AutofillTable(const std::string& app_locale) |
335 : app_locale_(AutofillCountry::ApplicationLocale()) { | 335 : app_locale_(app_locale) { |
336 } | 336 } |
337 | 337 |
338 AutofillTable::~AutofillTable() { | 338 AutofillTable::~AutofillTable() { |
339 } | 339 } |
340 | 340 |
341 AutofillTable* AutofillTable::FromWebDatabase(WebDatabase* db) { | 341 AutofillTable* AutofillTable::FromWebDatabase(WebDatabase* db) { |
342 return static_cast<AutofillTable*>(db->GetTable(GetKey())); | 342 return static_cast<AutofillTable*>(db->GetTable(GetKey())); |
343 } | 343 } |
344 | 344 |
345 WebDatabaseTable::TypeKey AutofillTable::GetTypeKey() const { | 345 WebDatabaseTable::TypeKey AutofillTable::GetTypeKey() const { |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 std::pair<std::string, int64>(guid, date_modified)); | 1985 std::pair<std::string, int64>(guid, date_modified)); |
1986 AutofillProfile* profile = NULL; | 1986 AutofillProfile* profile = NULL; |
1987 if (!GetAutofillProfile(guid, &profile)) | 1987 if (!GetAutofillProfile(guid, &profile)) |
1988 return false; | 1988 return false; |
1989 | 1989 |
1990 scoped_ptr<AutofillProfile> p(profile); | 1990 scoped_ptr<AutofillProfile> p(profile); |
1991 | 1991 |
1992 if (PersonalDataManager::IsValidLearnableProfile(*p)) { | 1992 if (PersonalDataManager::IsValidLearnableProfile(*p)) { |
1993 std::vector<AutofillProfile> merged_profiles; | 1993 std::vector<AutofillProfile> merged_profiles; |
1994 bool merged = PersonalDataManager::MergeProfile( | 1994 bool merged = PersonalDataManager::MergeProfile( |
1995 *p, accumulated_profiles_p, &merged_profiles); | 1995 *p, accumulated_profiles_p, app_locale_, &merged_profiles); |
1996 | 1996 |
1997 std::swap(accumulated_profiles, merged_profiles); | 1997 std::swap(accumulated_profiles, merged_profiles); |
1998 | 1998 |
1999 accumulated_profiles_p.clear(); | 1999 accumulated_profiles_p.clear(); |
2000 accumulated_profiles_p.resize(accumulated_profiles.size()); | 2000 accumulated_profiles_p.resize(accumulated_profiles.size()); |
2001 std::transform(accumulated_profiles.begin(), | 2001 std::transform(accumulated_profiles.begin(), |
2002 accumulated_profiles.end(), | 2002 accumulated_profiles.end(), |
2003 accumulated_profiles_p.begin(), | 2003 accumulated_profiles_p.begin(), |
2004 address_of<AutofillProfile>); | 2004 address_of<AutofillProfile>); |
2005 | 2005 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 "WHERE guid=?")); | 2038 "WHERE guid=?")); |
2039 s_date.BindInt64(0, date_item->second); | 2039 s_date.BindInt64(0, date_item->second); |
2040 s_date.BindString(1, iter->guid()); | 2040 s_date.BindString(1, iter->guid()); |
2041 | 2041 |
2042 if (!s_date.Run()) | 2042 if (!s_date.Run()) |
2043 return false; | 2043 return false; |
2044 } | 2044 } |
2045 | 2045 |
2046 return true; | 2046 return true; |
2047 } | 2047 } |
OLD | NEW |