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

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

Issue 507053: Differentiate between ADD and CHANGED when adding new autofill entries. (Closed)
Patch Set: Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_WEB_DATABASE_H_ 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_
6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ 6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/sql/connection.h" 10 #include "app/sql/connection.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // the 'Never for this site' button. 123 // the 'Never for this site' button.
124 bool GetAllLogins(std::vector<webkit_glue::PasswordForm*>* forms, 124 bool GetAllLogins(std::vector<webkit_glue::PasswordForm*>* forms,
125 bool include_blacklisted); 125 bool include_blacklisted);
126 126
127 ////////////////////////////////////////////////////////////////////////////// 127 //////////////////////////////////////////////////////////////////////////////
128 // 128 //
129 // Autofill 129 // Autofill
130 // 130 //
131 ////////////////////////////////////////////////////////////////////////////// 131 //////////////////////////////////////////////////////////////////////////////
132 132
133 // Records the form elements in |elements| in the database in the autofill 133 // Records the form elements in |elements| in the database in the
134 // table. 134 // autofill table. A list of all added and updated autofill entries
135 bool AddFormFieldValues(const std::vector<webkit_glue::FormField>& elements); 135 // is returned in the changes out parameter.
136 bool AddFormFieldValues(const std::vector<webkit_glue::FormField>& elements,
137 std::vector<AutofillChange>* changes);
136 138
137 // Records a single form element in in the database in the autofill table. 139 // Records a single form element in in the database in the autofill
138 bool AddFormFieldValue(const webkit_glue::FormField& element); 140 // table. A list of all added and updated autofill entries is
141 // returned in the changes out parameter.
142 bool AddFormFieldValue(const webkit_glue::FormField& element,
143 std::vector<AutofillChange>* changes);
139 144
140 // Retrieves a vector of all values which have been recorded in the autofill 145 // Retrieves a vector of all values which have been recorded in the autofill
141 // table as the value in a form element with name |name| and which start with 146 // table as the value in a form element with name |name| and which start with
142 // |prefix|. The comparison of the prefix is case insensitive. 147 // |prefix|. The comparison of the prefix is case insensitive.
143 bool GetFormValuesForElementName(const string16& name, 148 bool GetFormValuesForElementName(const string16& name,
144 const string16& prefix, 149 const string16& prefix,
145 std::vector<string16>* values, 150 std::vector<string16>* values,
146 int limit); 151 int limit);
147 152
148 // Removes rows from autofill_dates if they were created on or after 153 // Removes rows from autofill_dates if they were created on or after
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bool SetWebAppImage(const GURL& url, const SkBitmap& image); 206 bool SetWebAppImage(const GURL& url, const SkBitmap& image);
202 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); 207 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images);
203 208
204 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); 209 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images);
205 bool GetWebAppHasAllImages(const GURL& url); 210 bool GetWebAppHasAllImages(const GURL& url);
206 211
207 bool RemoveWebApp(const GURL& url); 212 bool RemoveWebApp(const GURL& url);
208 213
209 private: 214 private:
210 FRIEND_TEST(WebDatabaseTest, Autofill); 215 FRIEND_TEST(WebDatabaseTest, Autofill);
216 FRIEND_TEST(WebDatabaseTest, Autofill_AddChanges);
211 FRIEND_TEST(WebDatabaseTest, Autofill_RemoveBetweenChanges); 217 FRIEND_TEST(WebDatabaseTest, Autofill_RemoveBetweenChanges);
212 218
213 // Methods for adding autofill entries at a specified time. For 219 // Methods for adding autofill entries at a specified time. For
214 // testing only. 220 // testing only.
215 bool AddFormFieldValuesTime( 221 bool AddFormFieldValuesTime(
216 const std::vector<webkit_glue::FormField>& elements, 222 const std::vector<webkit_glue::FormField>& elements,
223 std::vector<AutofillChange>* changes,
217 base::Time time); 224 base::Time time);
218 bool AddFormFieldValueTime(const webkit_glue::FormField& element, 225 bool AddFormFieldValueTime(const webkit_glue::FormField& element,
226 std::vector<AutofillChange>* changes,
219 base::Time time); 227 base::Time time);
220 228
221 // Removes empty values for autofill that were incorrectly stored in the DB 229 // Removes empty values for autofill that were incorrectly stored in the DB
222 // (see bug http://crbug.com/6111). 230 // (see bug http://crbug.com/6111).
223 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have 231 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have
224 // run this code. 232 // run this code.
225 bool ClearAutofillEmptyValueElements(); 233 bool ClearAutofillEmptyValueElements();
226 234
227 bool InitKeywordsTable(); 235 bool InitKeywordsTable();
228 bool InitLoginsTable(); 236 bool InitLoginsTable();
229 bool InitAutofillTable(); 237 bool InitAutofillTable();
230 bool InitAutofillDatesTable(); 238 bool InitAutofillDatesTable();
231 bool InitWebAppIconsTable(); 239 bool InitWebAppIconsTable();
232 bool InitWebAppsTable(); 240 bool InitWebAppsTable();
233 241
234 void MigrateOldVersionsAsNeeded(); 242 void MigrateOldVersionsAsNeeded();
235 243
236 sql::Connection db_; 244 sql::Connection db_;
237 sql::MetaTable meta_table_; 245 sql::MetaTable meta_table_;
238 246
239 DISALLOW_COPY_AND_ASSIGN(WebDatabase); 247 DISALLOW_COPY_AND_ASSIGN(WebDatabase);
240 }; 248 };
241 249
242 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ 250 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service_unittest.cc ('k') | chrome/browser/webdata/web_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698