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

Unified Diff: chrome/browser/fav_icon_helper.cc

Issue 5753007: Make us save favicon in incognito mode if the url is bookmarked. This (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Created 10 years 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/fav_icon_helper.cc
diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc
index bcc3e90c2f5eac895df3647e6de5640968f7b413..544b4e8701773ef83805e43bbc29cea3fa9cec82 100644
--- a/chrome/browser/fav_icon_helper.cc
+++ b/chrome/browser/fav_icon_helper.cc
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/ref_counted_memory.h"
+#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
@@ -78,7 +79,7 @@ void FavIconHelper::SetFavIcon(
(image.width() == kFavIconSize && image.height() == kFavIconSize)
? image : ConvertToFavIconSize(image);
- if (GetFaviconService() && !profile()->IsOffTheRecord()) {
+ if (GetFaviconService() && ShouldSaveFavicon(url)) {
std::vector<unsigned char> image_data;
gfx::PNGCodec::EncodeBGRASkBitmap(sized_image, false, &image_data);
GetFaviconService()->SetFavicon(url, image_url, image_data);
@@ -296,3 +297,12 @@ SkBitmap FavIconHelper::ConvertToFavIconSize(const SkBitmap& image) {
}
return image;
}
+
+bool FavIconHelper::ShouldSaveFavicon(const GURL& url) {
+ if (!profile()->IsOffTheRecord())
+ return true;
+
+ // Otherwise store the favicon if the page is bookmarked.
+ BookmarkModel* bookmark_model = profile()->GetBookmarkModel();
+ return bookmark_model && bookmark_model->IsBookmarked(url);
+}

Powered by Google App Engine
This is Rietveld 408576698