| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Removes rows from autofill_dates if they were created on or after | 147 // Removes rows from autofill_dates if they were created on or after |
| 148 // |delete_begin| and strictly before |delete_end|. Decrements the | 148 // |delete_begin| and strictly before |delete_end|. Decrements the |
| 149 // count of the corresponding rows in the autofill table, and | 149 // count of the corresponding rows in the autofill table, and |
| 150 // removes those rows if the count goes to 0. A list of all changed | 150 // removes those rows if the count goes to 0. A list of all changed |
| 151 // keys and whether each was updater or removed is returned in the | 151 // keys and whether each was updater or removed is returned in the |
| 152 // changes out parameter. | 152 // changes out parameter. |
| 153 bool RemoveFormElementsAddedBetween(const base::Time& delete_begin, | 153 bool RemoveFormElementsAddedBetween(const base::Time& delete_begin, |
| 154 const base::Time& delete_end, | 154 const base::Time& delete_end, |
| 155 std::vector<AutofillChange>* changes); | 155 std::vector<AutofillChange>* changes); |
| 156 | 156 |
| 157 // Removes rows from autofill_dates if they were accessed strictly before |
| 158 // |AutofillEntry::ExpirationTime()|. Removes the corresponding row from the |
| 159 // autofill table. Also culls timestamps to only two. TODO(georgey): remove |
| 160 // culling in future versions. |
| 161 bool RemoveExpiredFormElements(std::vector<AutofillChange>* changes); |
| 162 |
| 157 // Removes from autofill_dates rows with given pair_id where date_created lies | 163 // Removes from autofill_dates rows with given pair_id where date_created lies |
| 158 // between delte_begin and delte_end. | 164 // between |delete_begin| and |delete_end|. |
| 159 bool RemoveFormElementForTimeRange(int64 pair_id, | 165 bool RemoveFormElementForTimeRange(int64 pair_id, |
| 160 const base::Time& delete_begin, | 166 const base::Time& delete_begin, |
| 161 const base::Time& delete_end, | 167 const base::Time& delete_end, |
| 162 int* how_many); | 168 int* how_many); |
| 163 | 169 |
| 164 // Increments the count in the row corresponding to |pair_id| by | 170 // Increments the count in the row corresponding to |pair_id| by |delta|. |
| 165 // |delta|. Removes the row from the table and sets the | 171 bool AddToCountOfFormElement(int64 pair_id, int delta); |
| 166 // |was_removed| out parameter to true if the count becomes 0. | 172 |
| 167 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed); | 173 // Counts how many timestamp data rows are in the |autofill_dates| table for |
| 174 // a given |pair_id|. GetCountOfFormElement() on the other hand gives the |
| 175 // |count| property for a given id. |
| 176 int CountTimestampsData(int64 pair_id); |
| 168 | 177 |
| 169 // Gets the pair_id and count entries from name and value specified in | 178 // Gets the pair_id and count entries from name and value specified in |
| 170 // |element|. Sets *pair_id and *count to 0 if there is no such row in | 179 // |element|. Sets *pair_id and *count to 0 if there is no such row in |
| 171 // the table. | 180 // the table. |
| 172 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, | 181 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, |
| 173 int64* pair_id, | 182 int64* pair_id, |
| 174 int* count); | 183 int* count); |
| 175 | 184 |
| 176 // Gets the count only given the pair_id. | 185 // Gets the count only given the pair_id. |
| 177 bool GetCountOfFormElement(int64 pair_id, int* count); | 186 bool GetCountOfFormElement(int64 pair_id, int* count); |
| 178 | 187 |
| 179 // Updates the count entry in the row corresponding to |pair_id| to |count|. | 188 // Updates the count entry in the row corresponding to |pair_id| to |count|. |
| 180 bool SetCountOfFormElement(int64 pair_id, int count); | 189 bool SetCountOfFormElement(int64 pair_id, int count); |
| 181 | 190 |
| 182 // Adds a new row to the autofill table with name and value given in | 191 // Adds a new row to the autofill table with name and value given in |
| 183 // |element|. Sets *pair_id to the pair_id of the new row. | 192 // |element|. Sets *pair_id to the pair_id of the new row. |
| 184 bool InsertFormElement(const webkit::forms::FormField& element, | 193 bool InsertFormElement(const webkit::forms::FormField& element, |
| 185 int64* pair_id); | 194 int64* pair_id); |
| 186 | 195 |
| 187 // Adds a new row to the autofill_dates table. | 196 // Adds a new row to the autofill_dates table. |
| 188 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); | 197 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); |
| 189 | 198 |
| 199 // Deletes last access to the Autofill data from the autofill_dates table. |
| 200 bool DeleteLastAccess(int64 pair_id); |
| 201 |
| 190 // Removes row from the autofill tables given |pair_id|. | 202 // Removes row from the autofill tables given |pair_id|. |
| 191 bool RemoveFormElementForID(int64 pair_id); | 203 bool RemoveFormElementForID(int64 pair_id); |
| 192 | 204 |
| 193 // Removes row from the autofill tables for the given |name| |value| pair. | 205 // Removes row from the autofill tables for the given |name| |value| pair. |
| 194 virtual bool RemoveFormElement(const string16& name, const string16& value); | 206 virtual bool RemoveFormElement(const string16& name, const string16& value); |
| 195 | 207 |
| 196 // Retrieves all of the entries in the autofill table. | 208 // Retrieves all of the entries in the autofill table. |
| 197 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); | 209 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); |
| 198 | 210 |
| 199 // Retrieves a single entry from the autofill table. | 211 // Retrieves a single entry from the autofill table. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 bool InitProfilesTable(); | 348 bool InitProfilesTable(); |
| 337 bool InitProfileNamesTable(); | 349 bool InitProfileNamesTable(); |
| 338 bool InitProfileEmailsTable(); | 350 bool InitProfileEmailsTable(); |
| 339 bool InitProfilePhonesTable(); | 351 bool InitProfilePhonesTable(); |
| 340 bool InitProfileTrashTable(); | 352 bool InitProfileTrashTable(); |
| 341 | 353 |
| 342 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 354 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
| 343 }; | 355 }; |
| 344 | 356 |
| 345 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 357 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| OLD | NEW |