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

Side by Side Diff: chrome/browser/webdata/autofill_table.cc

Issue 10898002: Refactor BrowsingDataRemover creation for clarity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | 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 (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>
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 std::vector<AutofillChange>* changes) { 398 std::vector<AutofillChange>* changes) {
399 DCHECK(changes); 399 DCHECK(changes);
400 // Query for the pair_id, name, and value of all form elements that 400 // Query for the pair_id, name, and value of all form elements that
401 // were used between the given times. 401 // were used between the given times.
402 sql::Statement s(db_->GetUniqueStatement( 402 sql::Statement s(db_->GetUniqueStatement(
403 "SELECT DISTINCT a.pair_id, a.name, a.value " 403 "SELECT DISTINCT a.pair_id, a.name, a.value "
404 "FROM autofill_dates ad JOIN autofill a ON ad.pair_id = a.pair_id " 404 "FROM autofill_dates ad JOIN autofill a ON ad.pair_id = a.pair_id "
405 "WHERE ad.date_created >= ? AND ad.date_created < ?")); 405 "WHERE ad.date_created >= ? AND ad.date_created < ?"));
406 s.BindInt64(0, delete_begin.ToTimeT()); 406 s.BindInt64(0, delete_begin.ToTimeT());
407 s.BindInt64(1, 407 s.BindInt64(1,
408 delete_end.is_null() ? 408 (delete_end.is_null() || delete_end == base::Time::Max()) ?
409 std::numeric_limits<int64>::max() : 409 std::numeric_limits<int64>::max() :
410 delete_end.ToTimeT()); 410 delete_end.ToTimeT());
411 411
412 AutofillElementList elements; 412 AutofillElementList elements;
413 while (s.Step()) { 413 while (s.Step()) {
414 elements.push_back(MakeTuple(s.ColumnInt64(0), 414 elements.push_back(MakeTuple(s.ColumnInt64(0),
415 s.ColumnString16(1), 415 s.ColumnString16(1),
416 s.ColumnString16(2))); 416 s.ColumnString16(2)));
417 } 417 }
418 if (!s.Succeeded()) 418 if (!s.Succeeded())
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 } 1137 }
1138 1138
1139 bool AutofillTable::RemoveAutofillProfilesAndCreditCardsModifiedBetween( 1139 bool AutofillTable::RemoveAutofillProfilesAndCreditCardsModifiedBetween(
1140 const Time& delete_begin, 1140 const Time& delete_begin,
1141 const Time& delete_end, 1141 const Time& delete_end,
1142 std::vector<std::string>* profile_guids, 1142 std::vector<std::string>* profile_guids,
1143 std::vector<std::string>* credit_card_guids) { 1143 std::vector<std::string>* credit_card_guids) {
1144 DCHECK(delete_end.is_null() || delete_begin < delete_end); 1144 DCHECK(delete_end.is_null() || delete_begin < delete_end);
1145 1145
1146 time_t delete_begin_t = delete_begin.ToTimeT(); 1146 time_t delete_begin_t = delete_begin.ToTimeT();
1147 time_t delete_end_t = delete_end.is_null() ? 1147 time_t delete_end_t =
1148 std::numeric_limits<time_t>::max() : 1148 (delete_end.is_null() || delete_end == base::Time::Max()) ?
1149 delete_end.ToTimeT(); 1149 std::numeric_limits<time_t>::max() : delete_end.ToTimeT();
1150 1150
1151 // Remember Autofill profiles in the time range. 1151 // Remember Autofill profiles in the time range.
1152 sql::Statement s_profiles_get(db_->GetUniqueStatement( 1152 sql::Statement s_profiles_get(db_->GetUniqueStatement(
1153 "SELECT guid FROM autofill_profiles " 1153 "SELECT guid FROM autofill_profiles "
1154 "WHERE date_modified >= ? AND date_modified < ?")); 1154 "WHERE date_modified >= ? AND date_modified < ?"));
1155 s_profiles_get.BindInt64(0, delete_begin_t); 1155 s_profiles_get.BindInt64(0, delete_begin_t);
1156 s_profiles_get.BindInt64(1, delete_end_t); 1156 s_profiles_get.BindInt64(1, delete_end_t);
1157 1157
1158 profile_guids->clear(); 1158 profile_guids->clear();
1159 while (s_profiles_get.Step()) { 1159 while (s_profiles_get.Step()) {
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 "WHERE guid=?")); 1978 "WHERE guid=?"));
1979 s_date.BindInt64(0, date_item->second); 1979 s_date.BindInt64(0, date_item->second);
1980 s_date.BindString(1, iter->guid()); 1980 s_date.BindString(1, iter->guid());
1981 1981
1982 if (!s_date.Run()) 1982 if (!s_date.Run())
1983 return false; 1983 return false;
1984 } 1984 }
1985 1985
1986 return true; 1986 return true;
1987 } 1987 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698