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

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

Issue 8144013: Add a check to the registry before the intent infobar is shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix provider to service in comments. Created 9 years, 1 month 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_intents_table.h ('k') | chrome/browser/webdata/web_intents_table_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2ad180b437f092e7739a7a21e431b924400b8e88..61bf89ad9afe853fd4c1b4caee8fb01f53241328 100644
--- a/chrome/browser/webdata/web_intents_table.cc
+++ b/chrome/browser/webdata/web_intents_table.cc
@@ -16,6 +16,9 @@ namespace {
bool ExtractIntents(sql::Statement* s,
std::vector<WebIntentServiceData>* services) {
DCHECK(s);
+ if (!s->is_valid())
+ return false;
+
while (s->Step()) {
WebIntentServiceData service;
string16 tmp = s->ColumnString16(0);
@@ -55,11 +58,11 @@ bool WebIntentsTable::Init() {
"title VARCHAR,"
"disposition VARCHAR,"
"UNIQUE (service_url, action, type))")) {
- NOTREACHED();
+ return false;
}
if (!db_->Execute("CREATE INDEX web_intents_index ON web_intents (action)"))
- NOTREACHED();
+ return false;
return true;
}
@@ -76,20 +79,31 @@ bool WebIntentsTable::GetWebIntentServices(
sql::Statement s(db_->GetUniqueStatement(
"SELECT service_url, action, type, title, disposition FROM web_intents "
"WHERE action=?"));
- if (!s)
- NOTREACHED() << "Statement prepare failed";
s.BindString16(0, action);
return ExtractIntents(&s, services);
}
+// TODO(gbillock): This currently does a full-table scan. Eventually we will
+// store registrations by domain, and so have an indexed origin. At that time,
+// this should just change to do lookup by origin instead of URL.
+bool WebIntentsTable::GetWebIntentServicesForURL(
+ const string16& service_url,
+ std::vector<WebIntentServiceData>* services) {
+ DCHECK(services);
+ sql::Statement s(db_->GetUniqueStatement(
+ "SELECT service_url, action, type, title, disposition FROM web_intents "
+ "WHERE service_url=?"));
+
+ s.BindString16(0, service_url);
+ return ExtractIntents(&s, services);
+}
+
bool WebIntentsTable::GetAllWebIntentServices(
std::vector<WebIntentServiceData>* services) {
DCHECK(services);
sql::Statement s(db_->GetUniqueStatement(
"SELECT service_url, action, type, title, disposition FROM web_intents"));
- if (!s)
- NOTREACHED() << "Statement prepare failed";
return ExtractIntents(&s, services);
}
@@ -99,8 +113,6 @@ bool WebIntentsTable::SetWebIntentService(const WebIntentServiceData& service) {
"INSERT OR REPLACE INTO web_intents "
"(service_url, type, action, title, disposition) "
"VALUES (?, ?, ?, ?, ?)"));
- if (!s)
- NOTREACHED() << "Statement prepare failed";
// Default to window disposition.
string16 disposition = ASCIIToUTF16("window");
@@ -122,8 +134,6 @@ bool WebIntentsTable::RemoveWebIntentService(
sql::Statement s(db_->GetUniqueStatement(
"DELETE FROM web_intents "
"WHERE service_url = ? AND action = ? AND type = ?"));
- if (!s)
- NOTREACHED() << "Statement prepare failed";
s.BindString(0, service.service_url.spec());
s.BindString16(1, service.action);
« no previous file with comments | « chrome/browser/webdata/web_intents_table.h ('k') | chrome/browser/webdata/web_intents_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698