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/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/string16.h" | 11 #include "base/string16.h" |
11 #include "chrome/browser/webdata/web_database_table.h" | 12 #include "chrome/browser/webdata/web_database_table.h" |
12 | 13 |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 class AutofillChange; | 16 class AutofillChange; |
16 class AutofillEntry; | 17 class AutofillEntry; |
17 class AutofillProfile; | 18 class AutofillProfile; |
| 19 class AutofillProfileSyncableService; |
18 class AutofillTableTest; | 20 class AutofillTableTest; |
19 class CreditCard; | 21 class CreditCard; |
| 22 class Profile; |
| 23 class WebDatabase; |
20 | 24 |
21 namespace base { | 25 namespace base { |
22 class Time; | 26 class Time; |
23 } | 27 } |
24 | 28 |
25 namespace webkit_glue { | 29 namespace webkit_glue { |
26 struct FormField; | 30 struct FormField; |
27 } | 31 } |
28 | 32 |
29 // This class manages the various autofill tables within the SQLite database | 33 // This class manages the various autofill tables within the SQLite database |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Added in version 31. | 113 // Added in version 31. |
110 // name_on_card | 114 // name_on_card |
111 // expiration_month | 115 // expiration_month |
112 // expiration_year | 116 // expiration_year |
113 // card_number_encrypted Stores encrypted credit card number. | 117 // card_number_encrypted Stores encrypted credit card number. |
114 // date_modified The date on which this entry was last modified. | 118 // date_modified The date on which this entry was last modified. |
115 // Added in version 30. | 119 // Added in version 30. |
116 // | 120 // |
117 class AutofillTable : public WebDatabaseTable { | 121 class AutofillTable : public WebDatabaseTable { |
118 public: | 122 public: |
119 AutofillTable(sql::Connection* db, sql::MetaTable* meta_table) | 123 AutofillTable(sql::Connection* db, sql::MetaTable* meta_table); |
120 : WebDatabaseTable(db, meta_table) {} | 124 virtual ~AutofillTable(); |
121 virtual ~AutofillTable() {} | |
122 virtual bool Init(); | 125 virtual bool Init(); |
123 virtual bool IsSyncable(); | 126 virtual bool IsSyncable(); |
124 | 127 |
| 128 // TODO(georgey): Add support for autocomplete as well: http://crbug.com/95759 |
| 129 // Returns the syncable service for Autofill addresses and credit cards stored |
| 130 // in this table. |
| 131 AutofillProfileSyncableService* GetSyncableService(WebDatabase* web_database, |
| 132 Profile* profile); |
| 133 |
125 // Records the form elements in |elements| in the database in the | 134 // Records the form elements in |elements| in the database in the |
126 // autofill table. A list of all added and updated autofill entries | 135 // autofill table. A list of all added and updated autofill entries |
127 // is returned in the changes out parameter. | 136 // is returned in the changes out parameter. |
128 bool AddFormFieldValues(const std::vector<webkit_glue::FormField>& elements, | 137 bool AddFormFieldValues(const std::vector<webkit_glue::FormField>& elements, |
129 std::vector<AutofillChange>* changes); | 138 std::vector<AutofillChange>* changes); |
130 | 139 |
131 // Records a single form element in the database in the autofill table. A list | 140 // 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 | 141 // of all added and updated autofill entries is returned in the changes out |
133 // parameter. | 142 // parameter. |
134 bool AddFormFieldValue(const webkit_glue::FormField& element, | 143 bool AddFormFieldValue(const webkit_glue::FormField& element, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 332 |
324 bool InitMainTable(); | 333 bool InitMainTable(); |
325 bool InitCreditCardsTable(); | 334 bool InitCreditCardsTable(); |
326 bool InitDatesTable(); | 335 bool InitDatesTable(); |
327 bool InitProfilesTable(); | 336 bool InitProfilesTable(); |
328 bool InitProfileNamesTable(); | 337 bool InitProfileNamesTable(); |
329 bool InitProfileEmailsTable(); | 338 bool InitProfileEmailsTable(); |
330 bool InitProfilePhonesTable(); | 339 bool InitProfilePhonesTable(); |
331 bool InitProfileTrashTable(); | 340 bool InitProfileTrashTable(); |
332 | 341 |
| 342 scoped_ptr<AutofillProfileSyncableService> autofill_profile_syncable_service_; |
| 343 |
333 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 344 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
334 }; | 345 }; |
335 | 346 |
336 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 347 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
OLD | NEW |