Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2841)

Unified Diff: chrome/browser/sync/glue/bookmark_change_processor.cc

Issue 10910212: Enable hidpi favicons for favicons history does not know about (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix FaviconHandlerTest.* Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698