Chromium Code Reviews| Index: chrome/browser/history/android/favicon_sql_handler.cc |
| diff --git a/chrome/browser/history/android/favicon_sql_handler.cc b/chrome/browser/history/android/favicon_sql_handler.cc |
| index dbf6eaf1bdc169741adf2a2ea8263b70ce194314..e9724285d643df863ded9fa4b5d9e28bfa697c55 100644 |
| --- a/chrome/browser/history/android/favicon_sql_handler.cc |
| +++ b/chrome/browser/history/android/favicon_sql_handler.cc |
| @@ -51,22 +51,19 @@ bool FaviconSQLHandler::Update(const HistoryAndBookmarkRow& row, |
| std::vector<FaviconID> favicon_ids; |
| for (TableIDRows::const_iterator i = ids_set.begin(); |
| i != ids_set.end(); ++i) { |
| + // Remove existing icon mappings. |
| std::vector<IconMapping> icon_mappings; |
| - if (thumbnail_db_->GetIconMappingsForPageURL(i->url, FAVICON, |
| - &icon_mappings)) { |
| - if (favicon_id) { |
| - if (!thumbnail_db_->UpdateIconMapping(icon_mappings[0].mapping_id, |
| - favicon_id)) |
| - return false; |
| - } else { |
| - // Require to delete the icon mapping. |
| - if (!thumbnail_db_->DeleteIconMappings(i->url)) |
| - return false; |
| - } |
| + thumbnail_db_->GetIconMappingsForPageURL(i->url, FAVICON, |
| + &icon_mappings); |
| + for (std::vector<IconMapping>::const_iterator m = icon_mappings.begin(); |
| + m != icon_mappings.end(); ++m) { |
| // Keep the old icon for deleting it later if possible. |
| - favicon_ids.push_back(icon_mappings[0].icon_id); |
| - } else if (favicon_id) { |
| - // The URL doesn't have icon before, add the icon mapping. |
| + favicon_ids.push_back(m->icon_id); |
| + } |
| + if (!thumbnail_db_->DeleteIconMappings(i->url)) |
|
michaelbai
2012/09/07 00:29:59
This not right, you will delete all the mappings o
pkotwicz
2012/09/07 01:07:04
Is it the case, that in the case of favicon_id !=
|
| + return false; |
| + if (favicon_id) { |
| + // Add the icon mapping. |
| if (!thumbnail_db_->AddIconMapping(i->url, favicon_id)) |
| return false; |
| } |