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

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

Issue 13822002: views/bookmarks: Refactor the way to get the default favicon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « no previous file | no next file » | 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 72fd27703a5896ad434e46c540cdd147e3a28573..62b701dd733f05c95109c9058607a1e04b09e421 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -450,7 +450,14 @@ const int BookmarkBarView::kMaxButtonWidth = 150;
const int BookmarkBarView::kNewtabHorizontalPadding = 8;
const int BookmarkBarView::kNewtabVerticalPadding = 12;
-// Returns the image to use for starred folders.
+static const gfx::ImageSkia& GetDefaultFavicon() {
+ if (!kDefaultFavicon) {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ kDefaultFavicon = rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
+ }
+ return *kDefaultFavicon;
+}
+
static const gfx::ImageSkia& GetFolderIcon() {
if (!kFolderIcon) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
@@ -1258,11 +1265,6 @@ void BookmarkBarView::Init() {
// UpdateColors(), which will set the appropriate colors for all the objects
// added in this function.
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
-
- if (!kDefaultFavicon)
- kDefaultFavicon = rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
-
// Child views are traversed in the order they are added. Make sure the order
// they are added matches the visual order.
overflow_button_ = CreateOverflowButton();
@@ -1414,7 +1416,7 @@ void BookmarkBarView::ConfigureButton(const BookmarkNode* node,
if (!favicon.IsEmpty())
button->SetIcon(*favicon.ToImageSkia());
else
- button->SetIcon(*kDefaultFavicon);
+ button->SetIcon(GetDefaultFavicon());
}
button->set_max_width(kMaxButtonWidth);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698