Chromium Code Reviews| Index: chrome/browser/history/thumbnail_database.cc |
| diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc |
| index 111f6078ee557f6cf39431a6f5e8c8a4d9b12480..4f1b5040c209519b96b2ee066d328a0f2d246fdb 100644 |
| --- a/chrome/browser/history/thumbnail_database.cc |
| +++ b/chrome/browser/history/thumbnail_database.cc |
| @@ -545,6 +545,35 @@ bool ThumbnailDatabase::HasMappingFor(FaviconID id) { |
| return statement.Step(); |
| } |
| +bool ThumbnailDatabase::CloneIconMapping(const GURL& old_page_url, |
| + const GURL& new_page_url) { |
| + sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, |
| + "SELECT COUNT(*) FROM icon_mapping " |
|
brettw
2011/11/15 00:02:42
I'm not doing real reviews since I'm on leave, so
groby-ooo-7-16
2011/11/16 00:31:39
Done.
|
| + "WHERE page_url=?")); |
| + if (!statement) |
| + return false; |
| + |
| + statement.BindString(0, URLDatabase::GURLToDatabaseURL(new_page_url)); |
| + if (!statement.Step()) |
| + return false; |
| + |
| + // Do nothing if there are existing bindings |
| + if (statement.ColumnInt(0) != 0) |
| + return true; |
| + |
| + statement.Assign(db_.GetCachedStatement(SQL_FROM_HERE, |
| + "INSERT INTO icon_mapping (page_url, icon_id) " |
| + "SELECT ?, icon_id FROM icon_mapping " |
| + "WHERE page_url = ?")); |
| + if (!statement) |
| + return false; |
| + |
| + statement.BindString(0, URLDatabase::GURLToDatabaseURL(new_page_url)); |
| + statement.BindString(1, URLDatabase::GURLToDatabaseURL(old_page_url)); |
| + return statement.Run(); |
| +} |
| + |
| + |
| bool ThumbnailDatabase::MigrateIconMappingData(URLDatabase* url_db) { |
| URLDatabase::IconMappingEnumerator e; |
| if (!url_db->InitIconMappingEnumeratorForEverything(&e)) |