Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table.cc

Issue 1007003007: Clear wallet data from autofill when disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 profile->language_code()); 945 profile->language_code());
946 946
947 profiles->push_back(profile.release()); 947 profiles->push_back(profile.release());
948 } 948 }
949 949
950 return s.Succeeded(); 950 return s.Succeeded();
951 } 951 }
952 952
953 void AutofillTable::SetServerProfiles( 953 void AutofillTable::SetServerProfiles(
954 const std::vector<AutofillProfile>& profiles) { 954 const std::vector<AutofillProfile>& profiles) {
955 sql::Transaction transaction(db_);
956 if (!transaction.Begin())
957 return;
958
955 // Delete all old ones first. 959 // Delete all old ones first.
956 sql::Statement delete_old(db_->GetUniqueStatement( 960 sql::Statement delete_old(db_->GetUniqueStatement(
957 "DELETE FROM server_addresses")); 961 "DELETE FROM server_addresses"));
958 delete_old.Run(); 962 delete_old.Run();
959 963
960 sql::Statement insert(db_->GetUniqueStatement( 964 sql::Statement insert(db_->GetUniqueStatement(
961 "INSERT INTO server_addresses(" 965 "INSERT INTO server_addresses("
962 "id," 966 "id,"
963 "recipient_name," 967 "recipient_name,"
964 "company_name," 968 "company_name,"
(...skipping 24 matching lines...) Expand all
989 index++; // SKip address_4 which we haven't added to AutofillProfile yet. 993 index++; // SKip address_4 which we haven't added to AutofillProfile yet.
990 insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_ZIP)); 994 insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_ZIP));
991 insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)); 995 insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE));
992 insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); 996 insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_COUNTRY));
993 insert.BindString16(index++, profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 997 insert.BindString16(index++, profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
994 insert.BindString(index++, profile.language_code()); 998 insert.BindString(index++, profile.language_code());
995 999
996 insert.Run(); 1000 insert.Run();
997 insert.Reset(true); 1001 insert.Reset(true);
998 } 1002 }
1003
1004 transaction.Commit();
999 } 1005 }
1000 1006
1001 bool AutofillTable::UpdateAutofillProfile(const AutofillProfile& profile) { 1007 bool AutofillTable::UpdateAutofillProfile(const AutofillProfile& profile) {
1002 DCHECK(base::IsValidGUID(profile.guid())); 1008 DCHECK(base::IsValidGUID(profile.guid()));
1003 1009
1004 // Don't update anything until the trash has been emptied. There may be 1010 // Don't update anything until the trash has been emptied. There may be
1005 // pending modifications to process. 1011 // pending modifications to process.
1006 if (!IsAutofillProfilesTrashEmpty()) 1012 if (!IsAutofillProfilesTrashEmpty())
1007 return true; 1013 return true;
1008 1014
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 if (!db_->DoesColumnExist("server_addresses", "phone_number") && 2024 if (!db_->DoesColumnExist("server_addresses", "phone_number") &&
2019 !db_->Execute("ALTER TABLE server_addresses ADD COLUMN " 2025 !db_->Execute("ALTER TABLE server_addresses ADD COLUMN "
2020 "phone_number VARCHAR")) { 2026 "phone_number VARCHAR")) {
2021 return false; 2027 return false;
2022 } 2028 }
2023 2029
2024 return transaction.Commit(); 2030 return transaction.Commit();
2025 } 2031 }
2026 2032
2027 } // namespace autofill 2033 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698