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

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

Issue 2126103003: Change chrome:// favicons in tabstrip based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/views/tabs/tab.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8a9dcd0f7d87ca21d709f5c10266a4c8753ccb67..94a2156fe13a4636f6189cf87e6fb2d1a2471538 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"
@@ -1787,10 +1788,21 @@ 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. This is similar to
+ // code in the tabstrip.
+ 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));
}
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/views/tabs/tab.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698