| 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_apps_table.h" | 5 #include "chrome/browser/webdata/web_apps_table.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/history/history_database.h" | 8 #include "chrome/browser/history/history_database.h" |
| 9 #include "components/webdata/common/web_database.h" | 9 #include "components/webdata/common/web_database.h" |
| 10 #include "sql/statement.h" | 10 #include "sql/statement.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 WebAppsTable* WebAppsTable::FromWebDatabase(WebDatabase* db) { | 26 WebAppsTable* WebAppsTable::FromWebDatabase(WebDatabase* db) { |
| 27 return static_cast<WebAppsTable*>(db->GetTable(GetKey())); | 27 return static_cast<WebAppsTable*>(db->GetTable(GetKey())); |
| 28 } | 28 } |
| 29 | 29 |
| 30 WebDatabaseTable::TypeKey WebAppsTable::GetTypeKey() const { | 30 WebDatabaseTable::TypeKey WebAppsTable::GetTypeKey() const { |
| 31 return GetKey(); | 31 return GetKey(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool WebAppsTable::Init(sql::Connection* db, sql::MetaTable* meta_table) { | 34 bool WebAppsTable::CreateTablesIfNecessary() { |
| 35 WebDatabaseTable::Init(db, meta_table); | |
| 36 | |
| 37 return (InitWebAppIconsTable() && InitWebAppsTable()); | 35 return (InitWebAppIconsTable() && InitWebAppsTable()); |
| 38 } | 36 } |
| 39 | 37 |
| 40 bool WebAppsTable::IsSyncable() { | 38 bool WebAppsTable::IsSyncable() { |
| 41 return true; | 39 return true; |
| 42 } | 40 } |
| 43 | 41 |
| 44 bool WebAppsTable::MigrateToVersion(int version, | 42 bool WebAppsTable::MigrateToVersion(int version, |
| 45 bool* update_compatible_version) { | 43 bool* update_compatible_version) { |
| 46 return true; | 44 return true; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 138 |
| 141 if (!delete_s.Run()) | 139 if (!delete_s.Run()) |
| 142 return false; | 140 return false; |
| 143 | 141 |
| 144 sql::Statement delete_s2(db_->GetUniqueStatement( | 142 sql::Statement delete_s2(db_->GetUniqueStatement( |
| 145 "DELETE FROM web_apps WHERE url = ?")); | 143 "DELETE FROM web_apps WHERE url = ?")); |
| 146 delete_s2.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url)); | 144 delete_s2.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url)); |
| 147 | 145 |
| 148 return delete_s2.Run(); | 146 return delete_s2.Run(); |
| 149 } | 147 } |
| OLD | NEW |