Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/webdata/web_intents_table.h" | 5 #include "chrome/browser/webdata/web_intents_table.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "sql/statement.h" | 10 #include "sql/statement.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool WebIntentsTable::Init() { | 50 bool WebIntentsTable::Init() { |
| 51 if (db_->DoesTableExist("web_intents")) | 51 if (db_->DoesTableExist("web_intents")) |
| 52 return true; | 52 return true; |
| 53 | 53 |
| 54 if (!db_->Execute("CREATE TABLE web_intents (" | 54 if (!db_->Execute("CREATE TABLE web_intents (" |
| 55 "service_url LONGVARCHAR," | 55 "service_url LONGVARCHAR," |
| 56 "action VARCHAR," | 56 "action VARCHAR," |
| 57 "type VARCHAR," | 57 "type VARCHAR," |
| 58 "title VARCHAR," | 58 "title LONGVARCHAR," |
| 59 "disposition VARCHAR," | 59 "disposition VARCHAR," |
| 60 "default_action VARCHAR," | |
|
James Hawkins
2012/01/30 20:50:08
These don't belong in the web_intents table. Defa
| |
| 61 "default_type VARCHAR," | |
| 62 "default_url LONGVARCHAR," | |
| 63 "default_user_date INTEGER," | |
| 64 "default_suppression INTEGER," | |
| 60 "UNIQUE (service_url, action, type))")) { | 65 "UNIQUE (service_url, action, type))")) { |
| 61 return false; | 66 return false; |
| 62 } | 67 } |
| 63 | 68 |
| 64 if (!db_->Execute("CREATE INDEX web_intents_index ON web_intents (action)")) | 69 if (!db_->Execute("CREATE INDEX web_intents_index ON web_intents (action)")) |
| 65 return false; | 70 return false; |
| 66 | 71 |
| 67 return true; | 72 return true; |
| 68 } | 73 } |
| 69 | 74 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 const WebIntentServiceData& service) { | 139 const WebIntentServiceData& service) { |
| 135 sql::Statement s(db_->GetUniqueStatement( | 140 sql::Statement s(db_->GetUniqueStatement( |
| 136 "DELETE FROM web_intents " | 141 "DELETE FROM web_intents " |
| 137 "WHERE service_url = ? AND action = ? AND type = ?")); | 142 "WHERE service_url = ? AND action = ? AND type = ?")); |
| 138 s.BindString(0, service.service_url.spec()); | 143 s.BindString(0, service.service_url.spec()); |
| 139 s.BindString16(1, service.action); | 144 s.BindString16(1, service.action); |
| 140 s.BindString16(2, service.type); | 145 s.BindString16(2, service.type); |
| 141 | 146 |
| 142 return s.Run(); | 147 return s.Run(); |
| 143 } | 148 } |
| OLD | NEW |