Index: chrome/browser/sync/glue/bookmark_change_processor.cc |
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc |
index cca79d0e78f6518392be7366d87205b8a98030a8..50efea3b23a615bf4aad2ad52207866714a3c51f 100644 |
--- a/chrome/browser/sync/glue/bookmark_change_processor.cc |
+++ b/chrome/browser/sync/glue/bookmark_change_processor.cc |
@@ -25,6 +25,7 @@ |
#include "sync/internal_api/public/write_node.h" |
#include "sync/internal_api/public/write_transaction.h" |
#include "sync/syncable/entry.h" // TODO(tim): Investigating bug 121587. |
+#include "ui/gfx/favicon_size.h" |
#include "ui/gfx/image/image_util.h" |
using content::BrowserThread; |
@@ -635,6 +636,11 @@ void BookmarkChangeProcessor::ApplyBookmarkFavicon( |
// which does not collide with others. |
GURL fake_icon_url = bookmark_node->url(); |
+ // As the favicon which is pushed to the sync service from BookmarkModel is |
+ // gfx::kFaviconSize in width and height, use gfx::kFaviconSize as a guess of |
+ // the size of the bitmap which is recieved from sync. |
+ gfx::Size pixel_size(gfx::kFaviconSize, gfx::kFaviconSize); |
+ |
HistoryService* history = |
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); |
FaviconService* favicon_service = |
@@ -642,10 +648,15 @@ void BookmarkChangeProcessor::ApplyBookmarkFavicon( |
history->AddPageNoVisitForBookmark(bookmark_node->url(), |
bookmark_node->GetTitle()); |
- favicon_service->SetFavicon(bookmark_node->url(), |
- fake_icon_url, |
- icon_bytes_vector, |
- history::FAVICON); |
+// The client may have cached the favicon at 2x. Use MergeFavicon() as not to |
+// overwrite the cached 2x favicon bitmap. |
+scoped_refptr<base::RefCountedMemory> bitmap_data( |
+ new base::RefCountedBytes(icon_bytes_vector)); |
+favicon_service->MergeFavicon(bookmark_node->url(), |
+ fake_icon_url, |
+ history::FAVICON, |
+ bitmap_data, |
+ pixel_size); |
} |
// static |