Chromium Code Reviews| 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 corresponding row from autofill | |
|
Ilya Sherman
2012/03/20 21:25:13
nit: "Removes corresponding row" -> "Removes the c
GeorgeY
2012/03/21 20:56:40
Done.
| |
| 159 // table. Also culls timestamps to only two. TODO(georgey): remove culling in | |
| 160 // 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|. | |
| 177 int CountTimestampsData(int64 pair_id); | |
|
Ilya Sherman
2012/03/20 21:25:13
This seems to be redundant with GetCountOfFormElem
GeorgeY
2012/03/21 20:56:40
Nope. Updated comment
Ilya Sherman
2012/03/21 21:20:53
Ah, makes sense -- thanks :)
| |
| 178 | |
| 169 // Gets the pair_id and count entries from name and value specified in | 179 // 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 | 180 // |element|. Sets *pair_id and *count to 0 if there is no such row in |
| 171 // the table. | 181 // the table. |
| 172 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, | 182 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, |
| 173 int64* pair_id, | 183 int64* pair_id, |
| 174 int* count); | 184 int* count); |
| 175 | 185 |
| 176 // Gets the count only given the pair_id. | 186 // Gets the count only given the pair_id. |
| 177 bool GetCountOfFormElement(int64 pair_id, int* count); | 187 bool GetCountOfFormElement(int64 pair_id, int* count); |
| 178 | 188 |
| 179 // Updates the count entry in the row corresponding to |pair_id| to |count|. | 189 // Updates the count entry in the row corresponding to |pair_id| to |count|. |
| 180 bool SetCountOfFormElement(int64 pair_id, int count); | 190 bool SetCountOfFormElement(int64 pair_id, int count); |
| 181 | 191 |
| 182 // Adds a new row to the autofill table with name and value given in | 192 // 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. | 193 // |element|. Sets *pair_id to the pair_id of the new row. |
| 184 bool InsertFormElement(const webkit::forms::FormField& element, | 194 bool InsertFormElement(const webkit::forms::FormField& element, |
| 185 int64* pair_id); | 195 int64* pair_id); |
| 186 | 196 |
| 187 // Adds a new row to the autofill_dates table. | 197 // Adds a new row to the autofill_dates table. |
| 188 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); | 198 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); |
| 189 | 199 |
| 200 // Deletes last access to the Autofill data from the autofill_dates table. | |
| 201 bool DeleteLastAccess(int64 pair_id); | |
| 202 | |
| 190 // Removes row from the autofill tables given |pair_id|. | 203 // Removes row from the autofill tables given |pair_id|. |
| 191 bool RemoveFormElementForID(int64 pair_id); | 204 bool RemoveFormElementForID(int64 pair_id); |
| 192 | 205 |
| 193 // Removes row from the autofill tables for the given |name| |value| pair. | 206 // Removes row from the autofill tables for the given |name| |value| pair. |
| 194 virtual bool RemoveFormElement(const string16& name, const string16& value); | 207 virtual bool RemoveFormElement(const string16& name, const string16& value); |
| 195 | 208 |
| 196 // Retrieves all of the entries in the autofill table. | 209 // Retrieves all of the entries in the autofill table. |
| 197 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); | 210 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); |
| 198 | 211 |
| 199 // Retrieves a single entry from the autofill table. | 212 // Retrieves a single entry from the autofill table. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 bool InitProfilesTable(); | 349 bool InitProfilesTable(); |
| 337 bool InitProfileNamesTable(); | 350 bool InitProfileNamesTable(); |
| 338 bool InitProfileEmailsTable(); | 351 bool InitProfileEmailsTable(); |
| 339 bool InitProfilePhonesTable(); | 352 bool InitProfilePhonesTable(); |
| 340 bool InitProfileTrashTable(); | 353 bool InitProfileTrashTable(); |
| 341 | 354 |
| 342 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 355 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
| 343 }; | 356 }; |
| 344 | 357 |
| 345 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 358 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| OLD | NEW |