AppCache INTERCEPT namespace.
- Add support for a custom CHROMIUM CACHE MANIFEST signature. Other browsers should ignore files with this signature.
- Parse intercept namespace entries out of the new CHROMIUM-INTERCEPT manifest section. Other browsers should ignore this entire section.
- Store and retrieve the new kind of namespace records in the database layer.
- Upgrade existing databases to the new schema.
- Look for matches in the new namespaces when handling main and sub resource requests.
- Add unit tests.

BUG=101565
Review URL: http://codereview.chromium.org/8396013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114151 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/sql/connection.cc b/sql/connection.cc
index 26e71fd..38fd62a 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -283,12 +283,22 @@
 }
 
 bool Connection::DoesTableExist(const char* table_name) const {
+  return DoesTableOrIndexExist(table_name, "table");
+}
+
+bool Connection::DoesIndexExist(const char* index_name) const {
+  return DoesTableOrIndexExist(index_name, "index");
+}
+
+bool Connection::DoesTableOrIndexExist(
+    const char* name, const char* type) const {
   // GetUniqueStatement can't be const since statements may modify the
   // database, but we know ours doesn't modify it, so the cast is safe.
   Statement statement(const_cast<Connection*>(this)->GetUniqueStatement(
       "SELECT name FROM sqlite_master "
-      "WHERE type='table' AND name=?"));
-  statement.BindString(0, table_name);
+      "WHERE type=? AND name=?"));
+  statement.BindString(0, type);
+  statement.BindString(1, name);
   return statement.Step();  // Table exists if any row was returned.
 }