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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 2091053002: Change chrome:// favicons in tabstrip based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac Created 4 years, 6 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/ui/views/bookmarks/bookmark_bar_view.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index e55eb2e077f93eae060943e45e6c22ac6b17bf00..159c40be337240871c90d54ba68e3fed5e2247d2 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -89,6 +89,7 @@
#include "ui/gfx/color_utils.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/gfx/text_constants.h"
@@ -1785,10 +1786,20 @@ void BookmarkBarView::ConfigureButton(const BookmarkNode* node,
button->set_context_menu_controller(this);
button->set_drag_controller(this);
if (node->is_url()) {
- const gfx::Image& favicon = model_->GetFavicon(node);
- button->SetImage(views::Button::STATE_NORMAL,
- favicon.IsEmpty() ? *GetImageSkiaNamed(IDR_DEFAULT_FAVICON)
- : *favicon.ToImageSkia());
+ // Themify chrome:// favicons and the default one.
Peter Kasting 2016/06/30 00:07:04 Nit: Might want to add "This ensures they're visib
Evan Stade 2016/06/30 15:39:45 Done.
+ bool themify_icon = node->url().SchemeIs(content::kChromeUIScheme);
+ gfx::ImageSkia favicon = model_->GetFavicon(node).AsImageSkia();
+ if (favicon.isNull()) {
+ favicon = *GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
+ themify_icon = true;
+ }
+
+ if (themify_icon && GetThemeProvider()) {
+ favicon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(
+ favicon, GetThemeProvider()->GetTint(ThemeProperties::TINT_BUTTONS));
+ }
+
+ button->SetImage(views::Button::STATE_NORMAL, favicon);
}
button->SetMaxSize(gfx::Size(kMaxButtonWidth, 0));
}

Powered by Google App Engine
This is Rietveld 408576698