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

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

Issue 7601013: Web Intents: Hook up the register intent InfoBar with the WebIntentsRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes and more\! Created 9 years, 4 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
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 e3b7bbfd9d1fc061f0918161a8fd05fbdfce8e10..4d59a8f6c1b2a2d57d4ca587bba76d66192c905e 100644
--- a/chrome/browser/webdata/web_intents_table.cc
+++ b/chrome/browser/webdata/web_intents_table.cc
@@ -24,6 +24,7 @@ bool WebIntentsTable::Init() {
"service_url LONGVARCHAR,"
"action VARCHAR,"
"type VARCHAR,"
+ "title VARCHAR,"
"UNIQUE (service_url, action, type))")) {
NOTREACHED();
return false;
@@ -68,26 +69,26 @@ bool WebIntentsTable::GetWebIntents(const string16& action,
return true;
}
-bool WebIntentsTable::SetWebIntent(const string16& action,
- const string16& type,
- const GURL& service_url) {
+bool WebIntentsTable::SetWebIntent(const WebIntentData& intent) {
sql::Statement s(db_->GetUniqueStatement(
- "INSERT OR REPLACE INTO web_intents (service_url, type, action) "
- "VALUES (?, ?, ?)"));
+ "INSERT OR REPLACE INTO web_intents (service_url, type, action, title) "
+ "VALUES (?, ?, ?, ?)"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
return false;
}
- s.BindString(0, service_url.spec());
- s.BindString16(1, type);
- s.BindString16(2, action);
+ s.BindString(0, intent.service_url.spec());
+ s.BindString16(1, intent.type);
+ s.BindString16(2, intent.action);
+ s.BindString16(3, intent.title);
return s.Run();
}
-bool WebIntentsTable::RemoveWebIntent(const string16& action,
- const string16& type,
- const GURL& service_url) {
+// TODO(jhawkins): Investigate the need to remove rows matching only
+// |intent.service_url|. It's unlikely the user will be given the ability to
groby-ooo-7-16 2011/08/09 18:17:33 I'd think the user will remove unique intents. (I.
James Hawkins 2011/08/09 18:39:03 Perhaps. I'd like to leave the TODO since it is a
+// remove at the granularity of actions or types.
+bool WebIntentsTable::RemoveWebIntent(const WebIntentData& intent) {
sql::Statement delete_s(db_->GetUniqueStatement(
"DELETE FROM web_intents "
"WHERE service_url = ? AND action = ? AND type = ?"));
@@ -96,9 +97,9 @@ bool WebIntentsTable::RemoveWebIntent(const string16& action,
return false;
}
- delete_s.BindString(0, service_url.spec());
- delete_s.BindString16(1, action);
- delete_s.BindString16(2, type);
+ delete_s.BindString(0, intent.service_url.spec());
+ delete_s.BindString16(1, intent.action);
+ delete_s.BindString16(2, intent.type);
return delete_s.Run();
}

Powered by Google App Engine
This is Rietveld 408576698