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

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

Issue 506047: Return a list of changed from WebDatabase::RemoveFormElementsAddedBetween() (Closed)
Patch Set: Remove unneeded include. 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
« no previous file with comments | « chrome/browser/webdata/web_data_service.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) 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"
11 #include "app/sql/meta_table.h" 11 #include "app/sql/meta_table.h"
12 #include "chrome/browser/search_engines/template_url.h" 12 #include "chrome/browser/search_engines/template_url.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "testing/gtest/include/gtest/gtest_prod.h" 14 #include "testing/gtest/include/gtest/gtest_prod.h"
15 #include "webkit/glue/form_field.h" 15 #include "webkit/glue/form_field.h"
16 16
17 class AutofillChange;
17 class FilePath; 18 class FilePath;
18 19
19 namespace base { 20 namespace base {
20 class Time; 21 class Time;
21 } 22 }
22 23
23 namespace webkit_glue { 24 namespace webkit_glue {
24 struct PasswordForm; 25 struct PasswordForm;
25 } 26 }
26 27
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 // 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
139 // 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
140 // |prefix|. The comparison of the prefix is case insensitive. 141 // |prefix|. The comparison of the prefix is case insensitive.
141 bool GetFormValuesForElementName(const string16& name, 142 bool GetFormValuesForElementName(const string16& name,
142 const string16& prefix, 143 const string16& prefix,
143 std::vector<string16>* values, 144 std::vector<string16>* values,
144 int limit); 145 int limit);
145 146
146 // 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
147 // |delete_begin| and strictly before |delete_end|. Decrements the count of 148 // |delete_begin| and strictly before |delete_end|. Decrements the
148 // the corresponding rows in the autofill table, and removes those rows if the 149 // count of the corresponding rows in the autofill table, and
149 // count goes to 0. 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
152 // changes out parameter.
150 bool RemoveFormElementsAddedBetween(base::Time delete_begin, 153 bool RemoveFormElementsAddedBetween(base::Time delete_begin,
151 base::Time delete_end); 154 base::Time delete_end,
155 std::vector<AutofillChange>* changes);
152 156
153 // Removes from autofill_dates rows with given pair_id where date_created lies 157 // Removes from autofill_dates rows with given pair_id where date_created lies
154 // between delte_begin and delte_end. 158 // between delte_begin and delte_end.
155 bool RemoveFormElementForTimeRange(int64 pair_id, 159 bool RemoveFormElementForTimeRange(int64 pair_id,
156 base::Time delete_begin, 160 base::Time delete_begin,
157 base::Time delete_end, 161 base::Time delete_end,
158 int* how_many); 162 int* how_many);
159 163
160 // Increments the count in the row corresponding to |pair_id| by |delta|. 164 // Increments the count in the row corresponding to |pair_id| by
161 // Removes the row from the table if the count becomes 0. 165 // |delta|. Removes the row from the table and sets the
162 bool AddToCountOfFormElement(int64 pair_id, int delta); 166 // |was_removed| out parameter to true if the count becomes 0.
167 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed);
163 168
164 // 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
165 // |element|. Sets *count to 0 if there is no such row in the table. 170 // |element|. Sets *count to 0 if there is no such row in the table.
166 bool GetIDAndCountOfFormElement(const webkit_glue::FormField& element, 171 bool GetIDAndCountOfFormElement(const webkit_glue::FormField& element,
167 int64* pair_id, 172 int64* pair_id,
168 int* count); 173 int* count);
169 174
170 // Gets the count only given the pair_id. 175 // Gets the count only given the pair_id.
171 bool GetCountOfFormElement(int64 pair_id, int* count); 176 bool GetCountOfFormElement(int64 pair_id, int* count);
172 177
(...skipping 22 matching lines...) Expand all
195 bool SetWebAppImage(const GURL& url, const SkBitmap& image); 200 bool SetWebAppImage(const GURL& url, const SkBitmap& image);
196 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); 201 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images);
197 202
198 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); 203 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images);
199 bool GetWebAppHasAllImages(const GURL& url); 204 bool GetWebAppHasAllImages(const GURL& url);
200 205
201 bool RemoveWebApp(const GURL& url); 206 bool RemoveWebApp(const GURL& url);
202 207
203 private: 208 private:
204 FRIEND_TEST(WebDatabaseTest, Autofill); 209 FRIEND_TEST(WebDatabaseTest, Autofill);
210 FRIEND_TEST(WebDatabaseTest, Autofill_RemoveBetweenChanges);
211
212 // Methods for adding autofill entries at a specified time. For
213 // testing only.
214 bool AddFormFieldValuesTime(
215 const std::vector<webkit_glue::FormField>& elements,
216 base::Time time);
217 bool AddFormFieldValueTime(const webkit_glue::FormField& element,
218 base::Time time);
205 219
206 // Removes empty values for autofill that were incorrectly stored in the DB 220 // Removes empty values for autofill that were incorrectly stored in the DB
207 // (see bug http://crbug.com/6111). 221 // (see bug http://crbug.com/6111).
208 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have 222 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have
209 // run this code. 223 // run this code.
210 bool ClearAutofillEmptyValueElements(); 224 bool ClearAutofillEmptyValueElements();
211 225
212 bool InitKeywordsTable(); 226 bool InitKeywordsTable();
213 bool InitLoginsTable(); 227 bool InitLoginsTable();
214 bool InitAutofillTable(); 228 bool InitAutofillTable();
215 bool InitAutofillDatesTable(); 229 bool InitAutofillDatesTable();
216 bool InitWebAppIconsTable(); 230 bool InitWebAppIconsTable();
217 bool InitWebAppsTable(); 231 bool InitWebAppsTable();
218 232
219 void MigrateOldVersionsAsNeeded(); 233 void MigrateOldVersionsAsNeeded();
220 234
221 sql::Connection db_; 235 sql::Connection db_;
222 sql::MetaTable meta_table_; 236 sql::MetaTable meta_table_;
223 237
224 DISALLOW_COPY_AND_ASSIGN(WebDatabase); 238 DISALLOW_COPY_AND_ASSIGN(WebDatabase);
225 }; 239 };
226 240
227 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ 241 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service.cc ('k') | chrome/browser/webdata/web_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698