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

Unified Diff: ui/message_center/notification_view.cc

Issue 12082064: makes NotificationView aware of border. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « ui/message_center/message_center_bubble.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/notification_view.cc
diff --git a/ui/message_center/notification_view.cc b/ui/message_center/notification_view.cc
index e0237965613631ca3f83783b50120c6cbd4f0244..13cd7a9109f4ae97eb52f09673c4e2b6e3017e7d 100644
--- a/ui/message_center/notification_view.cc
+++ b/ui/message_center/notification_view.cc
@@ -226,17 +226,25 @@ NotificationView::~NotificationView() {
void NotificationView::Layout() {
if (content_view_) {
- content_view_->SetBoundsRect(GetLocalBounds());
+ gfx::Rect contents_bounds = GetContentsBounds();
+ content_view_->SetBoundsRect(contents_bounds);
if (close_button()) {
gfx::Size size(close_button()->GetPreferredSize());
- close_button()->SetBounds(width() - size.width(), 0,
+ close_button()->SetBounds(contents_bounds.right() - size.width(), 0,
size.width(), size.height());
}
}
}
gfx::Size NotificationView::GetPreferredSize() {
- return content_view_ ? content_view_->GetPreferredSize() : gfx::Size();
+ if (!content_view_)
+ return gfx::Size();
+ gfx::Size size = content_view_->GetPreferredSize();
+ if (border()) {
+ gfx::Insets border_insets = border()->GetInsets();
+ size.Enlarge(border_insets.width(), border_insets.height());
+ }
+ return size;
}
void NotificationView::SetUpView() {
@@ -246,7 +254,6 @@ void NotificationView::SetUpView() {
// expand button. This allows the close and expand buttons to overlap the
// content as needed to provide a large enough click area
// (<http://crbug.com/168822> and touch area <http://crbug.com/168856>).
- set_background(views::Background::CreateSolidBackground(kBackgroundColor));
AddChildView(MakeContentView());
AddChildView(close_button());
}
@@ -264,6 +271,8 @@ void NotificationView::ButtonPressed(views::Button* sender,
views::View* NotificationView::MakeContentView() {
content_view_ = new views::View();
+ content_view_->set_background(
+ views::Background::CreateSolidBackground(kBackgroundColor));
// The top part of the content view is composed of an icon view on the left
// and a certain number of text views on the right (title and message or list
« no previous file with comments | « ui/message_center/message_center_bubble.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698