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

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

Issue 8680040: Group forms-related files in webkit/glue in a forms/ subdirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + another build fix Created 9 years 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
OLDNEW
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"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "chrome/browser/webdata/web_database_table.h" 12 #include "chrome/browser/webdata/web_database_table.h"
13 13
14 #include <vector> 14 #include <vector>
15 15
16 class AutofillChange; 16 class AutofillChange;
17 class AutofillEntry; 17 class AutofillEntry;
18 class AutofillProfile; 18 class AutofillProfile;
19 class AutofillTableTest; 19 class AutofillTableTest;
20 class CreditCard; 20 class CreditCard;
21 21
22 namespace base { 22 namespace base {
23 class Time; 23 class Time;
24 } 24 }
25 25
26 namespace webkit_glue { 26 namespace webkit {
27 namespace forms {
27 struct FormField; 28 struct FormField;
28 } 29 }
30 }
29 31
30 // This class manages the various autofill tables within the SQLite database 32 // This class manages the various autofill tables within the SQLite database
31 // passed to the constructor. It expects the following schemas: 33 // passed to the constructor. It expects the following schemas:
32 // 34 //
33 // Note: The database stores time in seconds, UTC. 35 // Note: The database stores time in seconds, UTC.
34 // 36 //
35 // autofill 37 // autofill
36 // name The name of the input as specified in the html. 38 // name The name of the input as specified in the html.
37 // value The literal contents of the text field. 39 // value The literal contents of the text field.
38 // value_lower The contents of the text field made lower_case. 40 // value_lower The contents of the text field made lower_case.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 class AutofillTable : public WebDatabaseTable { 120 class AutofillTable : public WebDatabaseTable {
119 public: 121 public:
120 AutofillTable(sql::Connection* db, sql::MetaTable* meta_table); 122 AutofillTable(sql::Connection* db, sql::MetaTable* meta_table);
121 virtual ~AutofillTable(); 123 virtual ~AutofillTable();
122 virtual bool Init() OVERRIDE; 124 virtual bool Init() OVERRIDE;
123 virtual bool IsSyncable() OVERRIDE; 125 virtual bool IsSyncable() OVERRIDE;
124 126
125 // Records the form elements in |elements| in the database in the 127 // Records the form elements in |elements| in the database in the
126 // autofill table. A list of all added and updated autofill entries 128 // autofill table. A list of all added and updated autofill entries
127 // is returned in the changes out parameter. 129 // is returned in the changes out parameter.
128 bool AddFormFieldValues(const std::vector<webkit_glue::FormField>& elements, 130 bool AddFormFieldValues(const std::vector<webkit::forms::FormField>& elements,
129 std::vector<AutofillChange>* changes); 131 std::vector<AutofillChange>* changes);
130 132
131 // Records a single form element in the database in the autofill table. A list 133 // Records a single form element in the database in the autofill table. A list
132 // of all added and updated autofill entries is returned in the changes out 134 // of all added and updated autofill entries is returned in the changes out
133 // parameter. 135 // parameter.
134 bool AddFormFieldValue(const webkit_glue::FormField& element, 136 bool AddFormFieldValue(const webkit::forms::FormField& element,
135 std::vector<AutofillChange>* changes); 137 std::vector<AutofillChange>* changes);
136 138
137 // Retrieves a vector of all values which have been recorded in the autofill 139 // Retrieves a vector of all values which have been recorded in the autofill
138 // table as the value in a form element with name |name| and which start with 140 // table as the value in a form element with name |name| and which start with
139 // |prefix|. The comparison of the prefix is case insensitive. 141 // |prefix|. The comparison of the prefix is case insensitive.
140 bool GetFormValuesForElementName(const string16& name, 142 bool GetFormValuesForElementName(const string16& name,
141 const string16& prefix, 143 const string16& prefix,
142 std::vector<string16>* values, 144 std::vector<string16>* values,
143 int limit); 145 int limit);
144 146
(...skipping 15 matching lines...) Expand all
160 int* how_many); 162 int* how_many);
161 163
162 // Increments the count in the row corresponding to |pair_id| by 164 // Increments the count in the row corresponding to |pair_id| by
163 // |delta|. Removes the row from the table and sets the 165 // |delta|. Removes the row from the table and sets the
164 // |was_removed| out parameter to true if the count becomes 0. 166 // |was_removed| out parameter to true if the count becomes 0.
165 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed); 167 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed);
166 168
167 // Gets the pair_id and count entries from name and value specified in 169 // Gets the pair_id and count entries from name and value specified in
168 // |element|. Sets *pair_id and *count to 0 if there is no such row in 170 // |element|. Sets *pair_id and *count to 0 if there is no such row in
169 // the table. 171 // the table.
170 bool GetIDAndCountOfFormElement(const webkit_glue::FormField& element, 172 bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element,
171 int64* pair_id, 173 int64* pair_id,
172 int* count); 174 int* count);
173 175
174 // Gets the count only given the pair_id. 176 // Gets the count only given the pair_id.
175 bool GetCountOfFormElement(int64 pair_id, int* count); 177 bool GetCountOfFormElement(int64 pair_id, int* count);
176 178
177 // Updates the count entry in the row corresponding to |pair_id| to |count|. 179 // Updates the count entry in the row corresponding to |pair_id| to |count|.
178 bool SetCountOfFormElement(int64 pair_id, int count); 180 bool SetCountOfFormElement(int64 pair_id, int count);
179 181
180 // Adds a new row to the autofill table with name and value given in 182 // Adds a new row to the autofill table with name and value given in
181 // |element|. Sets *pair_id to the pair_id of the new row. 183 // |element|. Sets *pair_id to the pair_id of the new row.
182 bool InsertFormElement(const webkit_glue::FormField& element, int64* pair_id); 184 bool InsertFormElement(const webkit::forms::FormField& element,
185 int64* pair_id);
183 186
184 // Adds a new row to the autofill_dates table. 187 // Adds a new row to the autofill_dates table.
185 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created); 188 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created);
186 189
187 // Removes row from the autofill tables given |pair_id|. 190 // Removes row from the autofill tables given |pair_id|.
188 bool RemoveFormElementForID(int64 pair_id); 191 bool RemoveFormElementForID(int64 pair_id);
189 192
190 // Removes row from the autofill tables for the given |name| |value| pair. 193 // Removes row from the autofill tables for the given |name| |value| pair.
191 virtual bool RemoveFormElement(const string16& name, const string16& value); 194 virtual bool RemoveFormElement(const string16& name, const string16& value);
192 195
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, 304 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest,
302 Autofill_GetAllAutofillEntries_OneResult); 305 Autofill_GetAllAutofillEntries_OneResult);
303 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, 306 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest,
304 Autofill_GetAllAutofillEntries_TwoDistinct); 307 Autofill_GetAllAutofillEntries_TwoDistinct);
305 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, 308 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest,
306 Autofill_GetAllAutofillEntries_TwoSame); 309 Autofill_GetAllAutofillEntries_TwoSame);
307 310
308 // Methods for adding autofill entries at a specified time. For 311 // Methods for adding autofill entries at a specified time. For
309 // testing only. 312 // testing only.
310 bool AddFormFieldValuesTime( 313 bool AddFormFieldValuesTime(
311 const std::vector<webkit_glue::FormField>& elements, 314 const std::vector<webkit::forms::FormField>& elements,
312 std::vector<AutofillChange>* changes, 315 std::vector<AutofillChange>* changes,
313 base::Time time); 316 base::Time time);
314 bool AddFormFieldValueTime(const webkit_glue::FormField& element, 317 bool AddFormFieldValueTime(const webkit::forms::FormField& element,
315 std::vector<AutofillChange>* changes, 318 std::vector<AutofillChange>* changes,
316 base::Time time); 319 base::Time time);
317 320
318 // Insert a single AutofillEntry into the autofill/autofill_dates tables. 321 // Insert a single AutofillEntry into the autofill/autofill_dates tables.
319 bool InsertAutofillEntry(const AutofillEntry& entry); 322 bool InsertAutofillEntry(const AutofillEntry& entry);
320 323
321 // Checks if the trash is empty. 324 // Checks if the trash is empty.
322 bool IsAutofillProfilesTrashEmpty(); 325 bool IsAutofillProfilesTrashEmpty();
323 326
324 // Checks if the guid is in the trash. 327 // Checks if the guid is in the trash.
325 bool IsAutofillGUIDInTrash(const std::string& guid); 328 bool IsAutofillGUIDInTrash(const std::string& guid);
326 329
327 bool InitMainTable(); 330 bool InitMainTable();
328 bool InitCreditCardsTable(); 331 bool InitCreditCardsTable();
329 bool InitDatesTable(); 332 bool InitDatesTable();
330 bool InitProfilesTable(); 333 bool InitProfilesTable();
331 bool InitProfileNamesTable(); 334 bool InitProfileNamesTable();
332 bool InitProfileEmailsTable(); 335 bool InitProfileEmailsTable();
333 bool InitProfilePhonesTable(); 336 bool InitProfilePhonesTable();
334 bool InitProfileTrashTable(); 337 bool InitProfileTrashTable();
335 338
336 DISALLOW_COPY_AND_ASSIGN(AutofillTable); 339 DISALLOW_COPY_AND_ASSIGN(AutofillTable);
337 }; 340 };
338 341
339 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ 342 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/password_manager_handler.cc ('k') | chrome/browser/webdata/autofill_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698