Index: chrome/browser/webdata/web_intents_table.cc |
diff --git a/chrome/browser/webdata/web_intents_table.cc b/chrome/browser/webdata/web_intents_table.cc |
index 4d59a8f6c1b2a2d57d4ca587bba76d66192c905e..03060ed0ffc94635b691a041e012ace1635b071a 100644 |
--- a/chrome/browser/webdata/web_intents_table.cc |
+++ b/chrome/browser/webdata/web_intents_table.cc |
@@ -69,6 +69,28 @@ bool WebIntentsTable::GetWebIntents(const string16& action, |
return true; |
} |
+bool WebIntentsTable::GetAllWebIntents(std::vector<WebIntentData>* intents) { |
+ DCHECK(intents); |
+ sql::Statement s(db_->GetUniqueStatement( |
+ "SELECT service_url, action, type FROM web_intents")); |
+ if (!s) { |
+ NOTREACHED() << "Statement prepare failed"; |
+ return false; |
+ } |
+ |
+ while (s.Step()) { |
+ WebIntentData intent; |
+ string16 tmp = s.ColumnString16(0); |
+ intent.service_url = GURL(tmp); |
+ |
+ intent.action = s.ColumnString16(1); |
+ intent.type = s.ColumnString16(2); |
+ |
+ intents->push_back(intent); |
+ } |
+ return true; |
+} |
+ |
bool WebIntentsTable::SetWebIntent(const WebIntentData& intent) { |
sql::Statement s(db_->GetUniqueStatement( |
"INSERT OR REPLACE INTO web_intents (service_url, type, action, title) " |
@@ -89,17 +111,17 @@ bool WebIntentsTable::SetWebIntent(const WebIntentData& intent) { |
// |intent.service_url|. It's unlikely the user will be given the ability to |
// remove at the granularity of actions or types. |
bool WebIntentsTable::RemoveWebIntent(const WebIntentData& intent) { |
- sql::Statement delete_s(db_->GetUniqueStatement( |
+ sql::Statement s(db_->GetUniqueStatement( |
"DELETE FROM web_intents " |
"WHERE service_url = ? AND action = ? AND type = ?")); |
- if (!delete_s) { |
+ if (!s) { |
NOTREACHED() << "Statement prepare failed"; |
return false; |
} |
- delete_s.BindString(0, intent.service_url.spec()); |
- delete_s.BindString16(1, intent.action); |
- delete_s.BindString16(2, intent.type); |
- return delete_s.Run(); |
+ s.BindString(0, intent.service_url.spec()); |
+ s.BindString16(1, intent.action); |
+ s.BindString16(2, intent.type); |
+ return s.Run(); |
} |