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 "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 set_focus_border(NULL); | 305 set_focus_border(NULL); |
306 if (IsRichNotificationEnabled()) { | 306 if (IsRichNotificationEnabled()) { |
307 set_background(views::Background::CreateSolidBackground( | 307 set_background(views::Background::CreateSolidBackground( |
308 kMessageCenterBackgroundColor)); | 308 kMessageCenterBackgroundColor)); |
309 SetVerticalScrollBar(new views::KennedyScrollBar(false)); | 309 SetVerticalScrollBar(new views::KennedyScrollBar(false)); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 gfx::Size BoundedScrollView::GetPreferredSize() { | 313 gfx::Size BoundedScrollView::GetPreferredSize() { |
314 gfx::Size size = contents()->GetPreferredSize(); | 314 gfx::Size size = contents()->GetPreferredSize(); |
315 size.ClampToMin(gfx::Size(size.width(), min_height_)); | 315 size.SetToMax(gfx::Size(size.width(), min_height_)); |
316 size.ClampToMax(gfx::Size(size.width(), max_height_)); | 316 size.SetToMin(gfx::Size(size.width(), max_height_)); |
317 gfx::Insets insets = GetInsets(); | 317 gfx::Insets insets = GetInsets(); |
318 size.Enlarge(insets.width(), insets.height()); | 318 size.Enlarge(insets.width(), insets.height()); |
319 return size; | 319 return size; |
320 } | 320 } |
321 | 321 |
322 int BoundedScrollView::GetHeightForWidth(int width) { | 322 int BoundedScrollView::GetHeightForWidth(int width) { |
323 gfx::Insets insets = GetInsets(); | 323 gfx::Insets insets = GetInsets(); |
324 width = std::max(0, width - insets.width()); | 324 width = std::max(0, width - insets.width()); |
325 int height = contents()->GetHeightForWidth(width) + insets.height(); | 325 int height = contents()->GetHeightForWidth(width) + insets.height(); |
326 return std::min(std::max(height, min_height_), max_height_); | 326 return std::min(std::max(height, min_height_), max_height_); |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 scroller_->InvalidateLayout(); | 918 scroller_->InvalidateLayout(); |
919 PreferredSizeChanged(); | 919 PreferredSizeChanged(); |
920 Layout(); | 920 Layout(); |
921 } | 921 } |
922 | 922 |
923 void MessageCenterView::SetNotificationViewForTest(views::View* view) { | 923 void MessageCenterView::SetNotificationViewForTest(views::View* view) { |
924 message_list_view_->AddNotificationAt(view, 0); | 924 message_list_view_->AddNotificationAt(view, 0); |
925 } | 925 } |
926 | 926 |
927 } // namespace message_center | 927 } // namespace message_center |
OLD | NEW |