| 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 |
| 165 // |delta|. Removes the row from the table and sets the | 171 // |delta|. Removes the row from the table and sets the |
| 166 // |was_removed| out parameter to true if the count becomes 0. | 172 // |was_removed| out parameter to true if the count becomes 0. |
| 167 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed); | 173 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed); |
| 168 | 174 |
| 175 // Counts how many timestamp data rows are in the |autofill_dates| table for |
| 176 // a given |pair_id|. GetCountOfFormElement() on the other hand gives the |
| 177 // |count| property for a given id. |
| 178 int CountTimestampsData(int64 pair_id); |
| 179 |
| 169 // Gets the pair_id and count entries from name and value specified in | 180 // 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 | 181 // |element|. Sets *pair_id and *count to 0 if there is no such row in |
| 171 // the table. | 182 // the table. |
| 172 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, | 183 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, |
| 173 int64* pair_id, | 184 int64* pair_id, |
| 174 int* count); | 185 int* count); |
| 175 | 186 |
| 176 // Gets the count only given the pair_id. | 187 // Gets the count only given the pair_id. |
| 177 bool GetCountOfFormElement(int64 pair_id, int* count); | 188 bool GetCountOfFormElement(int64 pair_id, int* count); |
| 178 | 189 |
| 179 // Updates the count entry in the row corresponding to |pair_id| to |count|. | 190 // Updates the count entry in the row corresponding to |pair_id| to |count|. |
| 180 bool SetCountOfFormElement(int64 pair_id, int count); | 191 bool SetCountOfFormElement(int64 pair_id, int count); |
| 181 | 192 |
| 182 // Adds a new row to the autofill table with name and value given in | 193 // 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. | 194 // |element|. Sets *pair_id to the pair_id of the new row. |
| 184 bool InsertFormElement(const webkit::forms::FormField& element, | 195 bool InsertFormElement(const webkit::forms::FormField& element, |
| 185 int64* pair_id); | 196 int64* pair_id); |
| 186 | 197 |
| 187 // Adds a new row to the autofill_dates table. | 198 // Adds a new row to the autofill_dates table. |
| 188 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); | 199 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); |
| 189 | 200 |
| 201 // Deletes last access to the Autofill data from the autofill_dates table. |
| 202 bool DeleteLastAccess(int64 pair_id); |
| 203 |
| 190 // Removes row from the autofill tables given |pair_id|. | 204 // Removes row from the autofill tables given |pair_id|. |
| 191 bool RemoveFormElementForID(int64 pair_id); | 205 bool RemoveFormElementForID(int64 pair_id); |
| 192 | 206 |
| 193 // Removes row from the autofill tables for the given |name| |value| pair. | 207 // Removes row from the autofill tables for the given |name| |value| pair. |
| 194 virtual bool RemoveFormElement(const string16& name, const string16& value); | 208 virtual bool RemoveFormElement(const string16& name, const string16& value); |
| 195 | 209 |
| 196 // Retrieves all of the entries in the autofill table. | 210 // Retrieves all of the entries in the autofill table. |
| 197 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); | 211 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); |
| 198 | 212 |
| 199 // Retrieves a single entry from the autofill table. | 213 // Retrieves a single entry from the autofill table. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 bool InitProfilesTable(); | 350 bool InitProfilesTable(); |
| 337 bool InitProfileNamesTable(); | 351 bool InitProfileNamesTable(); |
| 338 bool InitProfileEmailsTable(); | 352 bool InitProfileEmailsTable(); |
| 339 bool InitProfilePhonesTable(); | 353 bool InitProfilePhonesTable(); |
| 340 bool InitProfileTrashTable(); | 354 bool InitProfileTrashTable(); |
| 341 | 355 |
| 342 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 356 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
| 343 }; | 357 }; |
| 344 | 358 |
| 345 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 359 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| OLD | NEW |