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

Unified Diff: chrome/browser/ui/views/download/download_shelf_view.cc

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
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;

Powered by Google App Engine
This is Rietveld 408576698