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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #include "ui/base/page_transition_types.h" 82 #include "ui/base/page_transition_types.h"
83 #include "ui/base/resource/resource_bundle.h" 83 #include "ui/base/resource/resource_bundle.h"
84 #include "ui/base/theme_provider.h" 84 #include "ui/base/theme_provider.h"
85 #include "ui/base/window_open_disposition.h" 85 #include "ui/base/window_open_disposition.h"
86 #include "ui/compositor/paint_recorder.h" 86 #include "ui/compositor/paint_recorder.h"
87 #include "ui/gfx/animation/slide_animation.h" 87 #include "ui/gfx/animation/slide_animation.h"
88 #include "ui/gfx/canvas.h" 88 #include "ui/gfx/canvas.h"
89 #include "ui/gfx/color_utils.h" 89 #include "ui/gfx/color_utils.h"
90 #include "ui/gfx/favicon_size.h" 90 #include "ui/gfx/favicon_size.h"
91 #include "ui/gfx/geometry/rect.h" 91 #include "ui/gfx/geometry/rect.h"
92 #include "ui/gfx/image/image_skia_operations.h"
92 #include "ui/gfx/paint_vector_icon.h" 93 #include "ui/gfx/paint_vector_icon.h"
93 #include "ui/gfx/scoped_canvas.h" 94 #include "ui/gfx/scoped_canvas.h"
94 #include "ui/gfx/text_constants.h" 95 #include "ui/gfx/text_constants.h"
95 #include "ui/gfx/text_elider.h" 96 #include "ui/gfx/text_elider.h"
96 #include "ui/gfx/vector_icons_public.h" 97 #include "ui/gfx/vector_icons_public.h"
97 #include "ui/resources/grit/ui_resources.h" 98 #include "ui/resources/grit/ui_resources.h"
98 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 99 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
99 #include "ui/views/animation/ink_drop_highlight.h" 100 #include "ui/views/animation/ink_drop_highlight.h"
100 #include "ui/views/button_drag_utils.h" 101 #include "ui/views/button_drag_utils.h"
101 #include "ui/views/controls/button/label_button.h" 102 #include "ui/views/controls/button/label_button.h"
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 if (node->is_folder()) { 1779 if (node->is_folder()) {
1779 button->SetImage(views::Button::STATE_NORMAL, 1780 button->SetImage(views::Button::STATE_NORMAL,
1780 chrome::GetBookmarkFolderIcon(color)); 1781 chrome::GetBookmarkFolderIcon(color));
1781 } 1782 }
1782 } 1783 }
1783 1784
1784 button->SetMinSize(gfx::Size()); 1785 button->SetMinSize(gfx::Size());
1785 button->set_context_menu_controller(this); 1786 button->set_context_menu_controller(this);
1786 button->set_drag_controller(this); 1787 button->set_drag_controller(this);
1787 if (node->is_url()) { 1788 if (node->is_url()) {
1788 const gfx::Image& favicon = model_->GetFavicon(node); 1789 // 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.
1789 button->SetImage(views::Button::STATE_NORMAL, 1790 bool themify_icon = node->url().SchemeIs(content::kChromeUIScheme);
1790 favicon.IsEmpty() ? *GetImageSkiaNamed(IDR_DEFAULT_FAVICON) 1791 gfx::ImageSkia favicon = model_->GetFavicon(node).AsImageSkia();
1791 : *favicon.ToImageSkia()); 1792 if (favicon.isNull()) {
1793 favicon = *GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
1794 themify_icon = true;
1795 }
1796
1797 if (themify_icon && GetThemeProvider()) {
1798 favicon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(
1799 favicon, GetThemeProvider()->GetTint(ThemeProperties::TINT_BUTTONS));
1800 }
1801
1802 button->SetImage(views::Button::STATE_NORMAL, favicon);
1792 } 1803 }
1793 button->SetMaxSize(gfx::Size(kMaxButtonWidth, 0)); 1804 button->SetMaxSize(gfx::Size(kMaxButtonWidth, 0));
1794 } 1805 }
1795 1806
1796 bool BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model, 1807 bool BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model,
1797 const BookmarkNode* parent, 1808 const BookmarkNode* parent,
1798 int index) { 1809 int index) {
1799 const bool needs_layout_and_paint = UpdateOtherAndManagedButtonsVisibility(); 1810 const bool needs_layout_and_paint = UpdateOtherAndManagedButtonsVisibility();
1800 if (parent != model->bookmark_bar_node()) 1811 if (parent != model->bookmark_bar_node())
1801 return needs_layout_and_paint; 1812 return needs_layout_and_paint;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 return; 2170 return;
2160 apps_page_shortcut_->SetVisible(visible); 2171 apps_page_shortcut_->SetVisible(visible);
2161 UpdateBookmarksSeparatorVisibility(); 2172 UpdateBookmarksSeparatorVisibility();
2162 LayoutAndPaint(); 2173 LayoutAndPaint();
2163 } 2174 }
2164 2175
2165 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { 2176 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() {
2166 if (UpdateOtherAndManagedButtonsVisibility()) 2177 if (UpdateOtherAndManagedButtonsVisibility())
2167 LayoutAndPaint(); 2178 LayoutAndPaint();
2168 } 2179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698