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 "chrome/browser/webdata/web_database.h" |
9 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
10 #include "sql/statement.h" | 11 #include "sql/statement.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "ui/gfx/codec/png_codec.h" | 13 #include "ui/gfx/codec/png_codec.h" |
13 | 14 |
14 bool WebAppsTable::Init() { | 15 namespace { |
| 16 |
| 17 WebDatabaseTable::TypeKey GetKey() { |
| 18 return reinterpret_cast<void*>(&WebAppsTable::FromWebDatabase); |
| 19 } |
| 20 |
| 21 } // namespace |
| 22 |
| 23 WebAppsTable* WebAppsTable::FromWebDatabase(WebDatabase* db) { |
| 24 return static_cast<WebAppsTable*>(db->GetTable(GetKey())); |
| 25 } |
| 26 |
| 27 WebDatabaseTable::TypeKey WebAppsTable::GetTypeKey() const { |
| 28 return GetKey(); |
| 29 } |
| 30 |
| 31 bool WebAppsTable::Init(sql::Connection* db, sql::MetaTable* meta_table) { |
| 32 WebDatabaseTable::Init(db, meta_table); |
| 33 |
15 return (InitWebAppIconsTable() && InitWebAppsTable()); | 34 return (InitWebAppIconsTable() && InitWebAppsTable()); |
16 } | 35 } |
17 | 36 |
18 bool WebAppsTable::IsSyncable() { | 37 bool WebAppsTable::IsSyncable() { |
19 return true; | 38 return true; |
20 } | 39 } |
21 | 40 |
22 bool WebAppsTable::MigrateToVersion(int version, | 41 bool WebAppsTable::MigrateToVersion(int version, |
23 const std::string& app_locale, | 42 const std::string& app_locale, |
24 bool* update_compatible_version) { | 43 bool* update_compatible_version) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 138 |
120 if (!delete_s.Run()) | 139 if (!delete_s.Run()) |
121 return false; | 140 return false; |
122 | 141 |
123 sql::Statement delete_s2(db_->GetUniqueStatement( | 142 sql::Statement delete_s2(db_->GetUniqueStatement( |
124 "DELETE FROM web_apps WHERE url = ?")); | 143 "DELETE FROM web_apps WHERE url = ?")); |
125 delete_s2.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url)); | 144 delete_s2.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url)); |
126 | 145 |
127 return delete_s2.Run(); | 146 return delete_s2.Run(); |
128 } | 147 } |
OLD | NEW |