Chromium Code Reviews| 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..0e10ade61bd4c9b8b7ff401b5cf0ae482b0f0ddf 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 ")); |
|
James Hawkins
2011/08/12 20:21:24
Remove trailing space in the string.
groby-ooo-7-16
2011/08/12 20:40:50
Done.
|
| + 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) " |
| @@ -84,22 +106,21 @@ bool WebIntentsTable::SetWebIntent(const WebIntentData& intent) { |
| s.BindString16(3, intent.title); |
| return s.Run(); |
| } |
| - |
|
James Hawkins
2011/08/12 20:21:24
Add this blank line back.
groby-ooo-7-16
2011/08/12 20:40:50
Done.
|
| // TODO(jhawkins): Investigate the need to remove rows matching only |
| // |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(); |
| } |