| 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 <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 layout->set_spread_blank_space(true); | 249 layout->set_spread_blank_space(true); |
| 250 SetLayoutManager(layout); | 250 SetLayoutManager(layout); |
| 251 | 251 |
| 252 // Set the margin to 0 for the layout. BoxLayout assumes the same margin | 252 // Set the margin to 0 for the layout. BoxLayout assumes the same margin |
| 253 // for top and bottom, but the bottom margin here should be smaller | 253 // for top and bottom, but the bottom margin here should be smaller |
| 254 // because of the shadow of message view. Use an empty border instead | 254 // because of the shadow of message view. Use an empty border instead |
| 255 // to provide this margin. | 255 // to provide this margin. |
| 256 gfx::Insets shadow_insets = MessageView::GetShadowInsets(); | 256 gfx::Insets shadow_insets = MessageView::GetShadowInsets(); |
| 257 set_background(views::Background::CreateSolidBackground( | 257 set_background(views::Background::CreateSolidBackground( |
| 258 kMessageCenterBackgroundColor)); | 258 kMessageCenterBackgroundColor)); |
| 259 set_border(views::Border::CreateEmptyBorder( | 259 SetBorder(views::Border::CreateEmptyBorder( |
| 260 top_down ? 0 : kMarginBetweenItems - shadow_insets.top(), /* top */ | 260 top_down ? 0 : kMarginBetweenItems - shadow_insets.top(), /* top */ |
| 261 kMarginBetweenItems - shadow_insets.left(), /* left */ | 261 kMarginBetweenItems - shadow_insets.left(), /* left */ |
| 262 top_down ? kMarginBetweenItems - shadow_insets.bottom() : 0, /* bottom */ | 262 top_down ? kMarginBetweenItems - shadow_insets.bottom() : 0, /* bottom */ |
| 263 kMarginBetweenItems - shadow_insets.right() /* right */)); | 263 kMarginBetweenItems - shadow_insets.right() /* right */)); |
| 264 } | 264 } |
| 265 | 265 |
| 266 MessageListView::~MessageListView() { | 266 MessageListView::~MessageListView() { |
| 267 if (animator_.get()) | 267 if (animator_.get()) |
| 268 animator_->RemoveObserver(this); | 268 animator_->RemoveObserver(this); |
| 269 } | 269 } |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 bool is_scrollable = false; | 794 bool is_scrollable = false; |
| 795 if (scroller_->visible()) | 795 if (scroller_->visible()) |
| 796 is_scrollable = scroller_->height() < message_list_view_->height(); | 796 is_scrollable = scroller_->height() < message_list_view_->height(); |
| 797 else | 797 else |
| 798 is_scrollable = settings_view_->IsScrollable(); | 798 is_scrollable = settings_view_->IsScrollable(); |
| 799 | 799 |
| 800 if (!animating) { | 800 if (!animating) { |
| 801 if (is_scrollable) { | 801 if (is_scrollable) { |
| 802 // Draw separator line on the top of the button bar if it is on the bottom | 802 // Draw separator line on the top of the button bar if it is on the bottom |
| 803 // or draw it at the bottom if the bar is on the top. | 803 // or draw it at the bottom if the bar is on the top. |
| 804 button_bar_->set_border(views::Border::CreateSolidSidedBorder( | 804 button_bar_->SetBorder(views::Border::CreateSolidSidedBorder( |
| 805 top_down_ ? 0 : 1, 0, top_down_ ? 1 : 0, 0, kFooterDelimiterColor)); | 805 top_down_ ? 0 : 1, 0, top_down_ ? 1 : 0, 0, kFooterDelimiterColor)); |
| 806 } else { | 806 } else { |
| 807 button_bar_->set_border(views::Border::CreateEmptyBorder( | 807 button_bar_->SetBorder(views::Border::CreateEmptyBorder( |
| 808 top_down_ ? 0 : 1, 0, top_down_ ? 1 : 0, 0)); | 808 top_down_ ? 0 : 1, 0, top_down_ ? 1 : 0, 0)); |
| 809 } | 809 } |
| 810 button_bar_->SchedulePaint(); | 810 button_bar_->SchedulePaint(); |
| 811 } | 811 } |
| 812 button_bar_->SetBounds(0, | 812 button_bar_->SetBounds(0, |
| 813 top_down_ ? 0 : height() - button_height, | 813 top_down_ ? 0 : height() - button_height, |
| 814 width(), | 814 width(), |
| 815 button_height); | 815 button_height); |
| 816 if (GetWidget()) | 816 if (GetWidget()) |
| 817 GetWidget()->GetRootView()->SchedulePaint(); | 817 GetWidget()->GetRootView()->SchedulePaint(); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 scroller_->InvalidateLayout(); | 1078 scroller_->InvalidateLayout(); |
| 1079 PreferredSizeChanged(); | 1079 PreferredSizeChanged(); |
| 1080 Layout(); | 1080 Layout(); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { | 1083 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { |
| 1084 message_list_view_->AddNotificationAt(view, 0); | 1084 message_list_view_->AddNotificationAt(view, 0); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 } // namespace message_center | 1087 } // namespace message_center |
| OLD | NEW |