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

Unified Diff: chrome/browser/webdata/web_database.cc

Issue 42258: Add way to remove entries from autocomplete (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/webdata/web_database.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_database.cc
===================================================================
--- chrome/browser/webdata/web_database.cc (revision 11686)
+++ chrome/browser/webdata/web_database.cc (working copy)
@@ -868,7 +868,7 @@
bool success = true;
for (std::set<int64>::const_iterator iter = ids.begin(); iter != ids.end();
++iter) {
- if (!RemoveFormElement(*iter))
+ if (!RemoveFormElementForID(*iter))
success = false;
}
@@ -1117,6 +1117,26 @@
return result;
}
+bool WebDatabase::RemoveFormElement(const std::wstring& name,
+ const std::wstring& value) {
+ // Find the id for that pair.
+ SQLStatement s;
+ if (s.prepare(db_,
+ "SELECT pair_id FROM autofill WHERE name = ? AND value= ?") !=
+ SQLITE_OK) {
+ NOTREACHED() << "Statement 1 prepare failed";
+ return false;
+ }
+ s.bind_wstring(0, name);
+ s.bind_wstring(1, value);
+
+ int result = s.step();
+ if (result != SQLITE_ROW)
+ return false;
+
+ return RemoveFormElementForID(s.column_int64(0));
+}
+
bool WebDatabase::AddToCountOfFormElement(int64 pair_id, int delta) {
int count = 0;
@@ -1124,7 +1144,7 @@
return false;
if (count + delta == 0) {
- if (!RemoveFormElement(pair_id))
+ if (!RemoveFormElementForID(pair_id))
return false;
} else {
if (!SetCountOfFormElement(pair_id, count + delta))
@@ -1133,7 +1153,7 @@
return true;
}
-bool WebDatabase::RemoveFormElement(int64 pair_id) {
+bool WebDatabase::RemoveFormElementForID(int64 pair_id) {
SQLStatement s;
if (s.prepare(db_,
"DELETE FROM autofill WHERE pair_id = ?") != SQLITE_OK) {
« no previous file with comments | « chrome/browser/webdata/web_database.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698