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

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

Issue 21217: Don't store empty values for autofill (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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
« no previous file with comments | « chrome/browser/browser_prefs.cc ('k') | chrome/browser/webdata/web_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // Removes rows from autofill_dates if they were created on or after 141 // Removes rows from autofill_dates if they were created on or after
142 // |delete_begin| and strictly before |delete_end|. Decrements the count of 142 // |delete_begin| and strictly before |delete_end|. Decrements the count of
143 // the corresponding rows in the autofill table, and removes those rows if the 143 // the corresponding rows in the autofill table, and removes those rows if the
144 // count goes to 0. 144 // count goes to 0.
145 bool RemoveFormElementsAddedBetween(const base::Time delete_begin, 145 bool RemoveFormElementsAddedBetween(const base::Time delete_begin,
146 const base::Time delete_end); 146 const base::Time delete_end);
147 147
148 // Removes from autofill_dates rows with given pair_id where date_created lies 148 // Removes from autofill_dates rows with given pair_id where date_created lies
149 // between delte_begin and delte_end. 149 // between delte_begin and delte_end.
150 bool RemovePairIDAndDate(int64 pair_id, 150 bool RemoveFormElementForTimeRange(int64 pair_id,
151 const base::Time delete_begin, 151 const base::Time delete_begin,
152 const base::Time delete_end, 152 const base::Time delete_end,
153 int* how_many); 153 int* how_many);
154 154
155 // Increments the count in the row corresponding to |pair_id| by |delta|. 155 // Increments the count in the row corresponding to |pair_id| by |delta|.
156 // Removes the row from the table if the count becomes 0. 156 // Removes the row from the table if the count becomes 0.
157 bool AddToCountOfFormElement(int64 pair_id, int delta); 157 bool AddToCountOfFormElement(int64 pair_id, int delta);
158 158
159 // Gets the pair_id and count entries from name and value specified in 159 // Gets the pair_id and count entries from name and value specified in
160 // |element|. Sets *count to 0 if there is no such row in the table. 160 // |element|. Sets *count to 0 if there is no such row in the table.
161 bool GetIDAndCountOfFormElement(const AutofillForm::Element& element, 161 bool GetIDAndCountOfFormElement(const AutofillForm::Element& element,
162 int64* pair_id, 162 int64* pair_id,
163 int* count); 163 int* count);
164 164
165 // Gets the count only given the pair_id. 165 // Gets the count only given the pair_id.
166 bool GetCountOfFormElement(int64 pair_id, 166 bool GetCountOfFormElement(int64 pair_id,
167 int* count); 167 int* count);
168 168
169 // Updates the count entry in the row corresponding to |pair_id| to |count|. 169 // Updates the count entry in the row corresponding to |pair_id| to |count|.
170 bool SetCountOfFormElement(int64 pair_id, int count); 170 bool SetCountOfFormElement(int64 pair_id, int count);
171 171
172 // Adds a new row to the autofill table with name and value given in 172 // Adds a new row to the autofill table with name and value given in
173 // |element|. Sets *pair_id to the pair_id of the new row. 173 // |element|. Sets *pair_id to the pair_id of the new row.
174 bool InsertFormElement(const AutofillForm::Element& element, int64* pair_id); 174 bool InsertFormElement(const AutofillForm::Element& element, int64* pair_id);
175 175
176 // Adds a new row to the autofill_dates table. 176 // Adds a new row to the autofill_dates table.
177 bool InsertPairIDAndDate(int64 pair_id, const base::Time date_created); 177 bool InsertPairIDAndDate(int64 pair_id, const base::Time date_created);
178 178
179 // Removes row from the autofill table given |pair_id|. 179 // Removes row from the autofill tables given |pair_id|.
180 bool RemoveFormElement(int64 pair_id); 180 bool RemoveFormElement(int64 pair_id);
181 181
182 ////////////////////////////////////////////////////////////////////////////// 182 //////////////////////////////////////////////////////////////////////////////
183 // 183 //
184 // Web Apps 184 // Web Apps
185 // 185 //
186 ////////////////////////////////////////////////////////////////////////////// 186 //////////////////////////////////////////////////////////////////////////////
187 187
188 bool SetWebAppImage(const GURL& url, const SkBitmap& image); 188 bool SetWebAppImage(const GURL& url, const SkBitmap& image);
189 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); 189 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images);
190 190
191 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); 191 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images);
192 bool GetWebAppHasAllImages(const GURL& url); 192 bool GetWebAppHasAllImages(const GURL& url);
193 193
194 bool RemoveWebApp(const GURL& url); 194 bool RemoveWebApp(const GURL& url);
195 195
196 private: 196 private:
197 friend class WebDatabaseTest; 197 FRIEND_TEST(WebDatabaseTest, Autofill);
198
199 // Removes empty values for autofill that were incorrectly stored in the DB
200 // (see bug http://crbug.com/6111).
201 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have
202 // run this code.
203 bool ClearAutofillEmptyValueElements();
198 204
199 bool InitKeywordsTable(); 205 bool InitKeywordsTable();
200 bool InitLoginsTable(); 206 bool InitLoginsTable();
201 bool InitAutofillTable(); 207 bool InitAutofillTable();
202 bool InitAutofillDatesTable(); 208 bool InitAutofillDatesTable();
203 bool InitWebAppIconsTable(); 209 bool InitWebAppIconsTable();
204 bool InitWebAppsTable(); 210 bool InitWebAppsTable();
205 211
206 void MigrateOldVersionsAsNeeded(); 212 void MigrateOldVersionsAsNeeded();
207 213
208 sqlite3* db_; 214 sqlite3* db_;
209 int transaction_nesting_; 215 int transaction_nesting_;
210 MetaTableHelper meta_table_; 216 MetaTableHelper meta_table_;
211 217
212 DISALLOW_COPY_AND_ASSIGN(WebDatabase); 218 DISALLOW_COPY_AND_ASSIGN(WebDatabase);
213 }; 219 };
214 220
215 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H__ 221 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H__
OLDNEW
« no previous file with comments | « chrome/browser/browser_prefs.cc ('k') | chrome/browser/webdata/web_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698