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

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

Issue 600873002: Order returning profiles and card by descending date_modified (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 } 923 }
924 924
925 bool AutofillTable::GetAutofillProfiles( 925 bool AutofillTable::GetAutofillProfiles(
926 std::vector<AutofillProfile*>* profiles) { 926 std::vector<AutofillProfile*>* profiles) {
927 DCHECK(profiles); 927 DCHECK(profiles);
928 profiles->clear(); 928 profiles->clear();
929 929
930 sql::Statement s(db_->GetUniqueStatement( 930 sql::Statement s(db_->GetUniqueStatement(
931 "SELECT guid " 931 "SELECT guid "
932 "FROM autofill_profiles " 932 "FROM autofill_profiles "
933 "ORDER BY date_modified, guid")); 933 "ORDER BY date_modified DESC, guid"));
Evan Stade 2014/09/25 00:00:06 I meant here, not on trunk
Ilya Sherman 2014/09/25 00:08:55 Oh, I have no idea how I missed that. My bad.
934 934
935 while (s.Step()) { 935 while (s.Step()) {
936 std::string guid = s.ColumnString(0); 936 std::string guid = s.ColumnString(0);
937 AutofillProfile* profile = NULL; 937 AutofillProfile* profile = NULL;
938 if (!GetAutofillProfile(guid, &profile)) 938 if (!GetAutofillProfile(guid, &profile))
939 return false; 939 return false;
940 profiles->push_back(profile); 940 profiles->push_back(profile);
941 } 941 }
942 942
943 return s.Succeeded(); 943 return s.Succeeded();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 } 1062 }
1063 1063
1064 bool AutofillTable::GetCreditCards( 1064 bool AutofillTable::GetCreditCards(
1065 std::vector<CreditCard*>* credit_cards) { 1065 std::vector<CreditCard*>* credit_cards) {
1066 DCHECK(credit_cards); 1066 DCHECK(credit_cards);
1067 credit_cards->clear(); 1067 credit_cards->clear();
1068 1068
1069 sql::Statement s(db_->GetUniqueStatement( 1069 sql::Statement s(db_->GetUniqueStatement(
1070 "SELECT guid " 1070 "SELECT guid "
1071 "FROM credit_cards " 1071 "FROM credit_cards "
1072 "ORDER BY date_modified, guid")); 1072 "ORDER BY date_modified DESC, guid"));
1073 1073
1074 while (s.Step()) { 1074 while (s.Step()) {
1075 std::string guid = s.ColumnString(0); 1075 std::string guid = s.ColumnString(0);
1076 CreditCard* credit_card = NULL; 1076 CreditCard* credit_card = NULL;
1077 if (!GetCreditCard(guid, &credit_card)) 1077 if (!GetCreditCard(guid, &credit_card))
1078 return false; 1078 return false;
1079 credit_cards->push_back(credit_card); 1079 credit_cards->push_back(credit_card);
1080 } 1080 }
1081 1081
1082 return s.Succeeded(); 1082 return s.Succeeded();
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 return db_->Execute("ALTER TABLE autofill_profiles " 2353 return db_->Execute("ALTER TABLE autofill_profiles "
2354 "ADD COLUMN language_code VARCHAR"); 2354 "ADD COLUMN language_code VARCHAR");
2355 } 2355 }
2356 2356
2357 bool AutofillTable::MigrateToVersion57AddFullNameField() { 2357 bool AutofillTable::MigrateToVersion57AddFullNameField() {
2358 return db_->Execute("ALTER TABLE autofill_profile_names " 2358 return db_->Execute("ALTER TABLE autofill_profile_names "
2359 "ADD COLUMN full_name VARCHAR"); 2359 "ADD COLUMN full_name VARCHAR");
2360 } 2360 }
2361 2361
2362 } // namespace autofill 2362 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698