diff options
Diffstat (limited to 'chrome/browser/webdata/web_intents_table.cc')
-rw-r--r-- | chrome/browser/webdata/web_intents_table.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/chrome/browser/webdata/web_intents_table.cc b/chrome/browser/webdata/web_intents_table.cc index 4d59a8f..03060ed 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(); } |