OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/views/message_center_view.h" | 5 #include "ui/message_center/views/message_center_view.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 set_focus_border(NULL); | 262 set_focus_border(NULL); |
263 if (IsRichNotificationEnabled()) { | 263 if (IsRichNotificationEnabled()) { |
264 set_background(views::Background::CreateSolidBackground( | 264 set_background(views::Background::CreateSolidBackground( |
265 kMessageCenterBackgroundColor)); | 265 kMessageCenterBackgroundColor)); |
266 SetVerticalScrollBar(new views::KennedyScrollBar(false)); | 266 SetVerticalScrollBar(new views::KennedyScrollBar(false)); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 gfx::Size BoundedScrollView::GetPreferredSize() { | 270 gfx::Size BoundedScrollView::GetPreferredSize() { |
271 gfx::Size size = contents()->GetPreferredSize(); | 271 gfx::Size size = contents()->GetPreferredSize(); |
272 size.ClampToMin(gfx::Size(size.width(), min_height_)); | 272 size.ClampToLowerBound(gfx::Size(size.width(), min_height_)); |
273 size.ClampToMax(gfx::Size(size.width(), max_height_)); | 273 size.ClampToUpperBound(gfx::Size(size.width(), max_height_)); |
274 gfx::Insets insets = GetInsets(); | 274 gfx::Insets insets = GetInsets(); |
275 size.Enlarge(insets.width(), insets.height()); | 275 size.Enlarge(insets.width(), insets.height()); |
276 return size; | 276 return size; |
277 } | 277 } |
278 | 278 |
279 int BoundedScrollView::GetHeightForWidth(int width) { | 279 int BoundedScrollView::GetHeightForWidth(int width) { |
280 gfx::Insets insets = GetInsets(); | 280 gfx::Insets insets = GetInsets(); |
281 width = std::max(0, width - insets.width()); | 281 width = std::max(0, width - insets.width()); |
282 int height = contents()->GetHeightForWidth(width) + insets.height(); | 282 int height = contents()->GetHeightForWidth(width) + insets.height(); |
283 return std::min(std::max(height, min_height_), max_height_); | 283 return std::min(std::max(height, min_height_), max_height_); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // NotificationViews are expanded by default here until | 446 // NotificationViews are expanded by default here until |
447 // http://crbug.com/217902 is fixed. TODO(dharcourt): Fix. | 447 // http://crbug.com/217902 is fixed. TODO(dharcourt): Fix. |
448 MessageView* view = NotificationView::Create( | 448 MessageView* view = NotificationView::Create( |
449 notification, message_center_, true); | 449 notification, message_center_, true); |
450 view->set_scroller(scroller_); | 450 view->set_scroller(scroller_); |
451 message_views_[notification.id()] = view; | 451 message_views_[notification.id()] = view; |
452 message_list_view_->AddChildView(view); | 452 message_list_view_->AddChildView(view); |
453 } | 453 } |
454 | 454 |
455 } // namespace message_center | 455 } // namespace message_center |
OLD | NEW |