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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 if (node->is_folder()) { 1781 if (node->is_folder()) {
1781 button->SetImage(views::Button::STATE_NORMAL, 1782 button->SetImage(views::Button::STATE_NORMAL,
1782 chrome::GetBookmarkFolderIcon(color)); 1783 chrome::GetBookmarkFolderIcon(color));
1783 } 1784 }
1784 } 1785 }
1785 1786
1786 button->SetMinSize(gfx::Size()); 1787 button->SetMinSize(gfx::Size());
1787 button->set_context_menu_controller(this); 1788 button->set_context_menu_controller(this);
1788 button->set_drag_controller(this); 1789 button->set_drag_controller(this);
1789 if (node->is_url()) { 1790 if (node->is_url()) {
1790 const gfx::Image& favicon = model_->GetFavicon(node); 1791 // Themify chrome:// favicons and the default one. This is similar to
1791 button->SetImage(views::Button::STATE_NORMAL, 1792 // code in the tabstrip.
1792 favicon.IsEmpty() ? *GetImageSkiaNamed(IDR_DEFAULT_FAVICON) 1793 bool themify_icon = node->url().SchemeIs(content::kChromeUIScheme);
1793 : *favicon.ToImageSkia()); 1794 gfx::ImageSkia favicon = model_->GetFavicon(node).AsImageSkia();
1795 if (favicon.isNull()) {
1796 favicon = *GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
1797 themify_icon = true;
1798 }
1799
1800 if (themify_icon && GetThemeProvider()) {
1801 favicon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(
1802 favicon, GetThemeProvider()->GetTint(ThemeProperties::TINT_BUTTONS));
1803 }
1804
1805 button->SetImage(views::Button::STATE_NORMAL, favicon);
1794 } 1806 }
1795 button->SetMaxSize(gfx::Size(kMaxButtonWidth, 0)); 1807 button->SetMaxSize(gfx::Size(kMaxButtonWidth, 0));
1796 } 1808 }
1797 1809
1798 bool BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model, 1810 bool BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model,
1799 const BookmarkNode* parent, 1811 const BookmarkNode* parent,
1800 int index) { 1812 int index) {
1801 const bool needs_layout_and_paint = UpdateOtherAndManagedButtonsVisibility(); 1813 const bool needs_layout_and_paint = UpdateOtherAndManagedButtonsVisibility();
1802 if (parent != model->bookmark_bar_node()) 1814 if (parent != model->bookmark_bar_node())
1803 return needs_layout_and_paint; 1815 return needs_layout_and_paint;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 return; 2173 return;
2162 apps_page_shortcut_->SetVisible(visible); 2174 apps_page_shortcut_->SetVisible(visible);
2163 UpdateBookmarksSeparatorVisibility(); 2175 UpdateBookmarksSeparatorVisibility();
2164 LayoutAndPaint(); 2176 LayoutAndPaint();
2165 } 2177 }
2166 2178
2167 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { 2179 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() {
2168 if (UpdateOtherAndManagedButtonsVisibility()) 2180 if (UpdateOtherAndManagedButtonsVisibility())
2169 LayoutAndPaint(); 2181 LayoutAndPaint();
2170 } 2182 }
OLDNEW
« 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