Index: chrome/browser/ui/views/download/download_shelf_view.cc |
=================================================================== |
--- chrome/browser/ui/views/download/download_shelf_view.cc (revision 104769) |
+++ chrome/browser/ui/views/download/download_shelf_view.cc (working copy) |
@@ -180,10 +180,8 @@ |
} |
views::View* DownloadShelfView::GetDefaultFocusableChild() { |
- if (!download_views_.empty()) |
- return download_views_[0]; |
- else |
- return show_all_view_; |
+ return download_views_.empty() ? |
+ static_cast<View*>(show_all_view_) : download_views_[0]; |
} |
void DownloadShelfView::OnPaint(gfx::Canvas* canvas) { |
@@ -251,12 +249,6 @@ |
} |
void DownloadShelfView::Layout() { |
- // Now that we know we have a parent, we can safely set our theme colors. |
- show_all_view_->SetColor( |
- GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); |
- set_background(views::Background::CreateSolidBackground( |
- GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR))); |
- |
// Let our base class layout our child views |
views::View::Layout(); |
@@ -327,6 +319,21 @@ |
} |
} |
+void DownloadShelfView::ViewHierarchyChanged(bool is_add, |
+ View* parent, |
+ View* child) { |
+ View::ViewHierarchyChanged(is_add, parent, child); |
+ |
+ if (is_add && (child == this)) { |
+ // Now that we know we have a parent, we can safely set our theme colors. |
+ set_background(views::Background::CreateSolidBackground( |
+ GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR))); |
+ show_all_view_->SetBackgroundColor(background()->get_color()); |
+ show_all_view_->SetEnabledColor( |
+ GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); |
+ } |
+} |
+ |
bool DownloadShelfView::CanFitFirstDownloadItem() { |
if (download_views_.empty()) |
return true; |