| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void UpdateNotification(MessageView* view, const Notification& notification); | 116 void UpdateNotification(MessageView* view, const Notification& notification); |
| 117 void SetRepositionTarget(const gfx::Rect& target_rect); | 117 void SetRepositionTarget(const gfx::Rect& target_rect); |
| 118 void ResetRepositionSession(); | 118 void ResetRepositionSession(); |
| 119 void ClearAllNotifications(const gfx::Rect& visible_scroll_rect); | 119 void ClearAllNotifications(const gfx::Rect& visible_scroll_rect); |
| 120 | 120 |
| 121 protected: | 121 protected: |
| 122 // Overridden from views::View. | 122 // Overridden from views::View. |
| 123 virtual void Layout() OVERRIDE; | 123 virtual void Layout() OVERRIDE; |
| 124 virtual gfx::Size GetPreferredSize() OVERRIDE; | 124 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 125 virtual int GetHeightForWidth(int width) OVERRIDE; | 125 virtual int GetHeightForWidth(int width) OVERRIDE; |
| 126 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 126 virtual void PaintChildren(gfx::Canvas* canvas, |
| 127 const views::CullSet& cull_set) OVERRIDE; |
| 127 virtual void ReorderChildLayers(ui::Layer* parent_layer) OVERRIDE; | 128 virtual void ReorderChildLayers(ui::Layer* parent_layer) OVERRIDE; |
| 128 | 129 |
| 129 // Overridden from views::BoundsAnimatorObserver. | 130 // Overridden from views::BoundsAnimatorObserver. |
| 130 virtual void OnBoundsAnimatorProgressed( | 131 virtual void OnBoundsAnimatorProgressed( |
| 131 views::BoundsAnimator* animator) OVERRIDE; | 132 views::BoundsAnimator* animator) OVERRIDE; |
| 132 virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; | 133 virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; |
| 133 | 134 |
| 134 private: | 135 private: |
| 135 bool IsValidChild(views::View* child); | 136 bool IsValidChild(views::View* child); |
| 136 void DoUpdateIfPossible(); | 137 void DoUpdateIfPossible(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 views::View* child = child_at(i); | 299 views::View* child = child_at(i); |
| 299 if (!IsValidChild(child)) | 300 if (!IsValidChild(child)) |
| 300 continue; | 301 continue; |
| 301 height += child->GetHeightForWidth(width) + padding; | 302 height += child->GetHeightForWidth(width) + padding; |
| 302 padding = kMarginBetweenItems - MessageView::GetShadowInsets().bottom(); | 303 padding = kMarginBetweenItems - MessageView::GetShadowInsets().bottom(); |
| 303 } | 304 } |
| 304 | 305 |
| 305 return height + GetInsets().height(); | 306 return height + GetInsets().height(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 void MessageListView::PaintChildren(gfx::Canvas* canvas) { | 309 void MessageListView::PaintChildren(gfx::Canvas* canvas, |
| 310 const views::CullSet& cull_set) { |
| 309 // Paint in the inversed order. Otherwise upper notification may be | 311 // Paint in the inversed order. Otherwise upper notification may be |
| 310 // hidden by the lower one. | 312 // hidden by the lower one. |
| 311 for (int i = child_count() - 1; i >= 0; --i) { | 313 for (int i = child_count() - 1; i >= 0; --i) { |
| 312 if (!child_at(i)->layer()) | 314 if (!child_at(i)->layer()) |
| 313 child_at(i)->Paint(canvas); | 315 child_at(i)->Paint(canvas, cull_set); |
| 314 } | 316 } |
| 315 } | 317 } |
| 316 | 318 |
| 317 void MessageListView::ReorderChildLayers(ui::Layer* parent_layer) { | 319 void MessageListView::ReorderChildLayers(ui::Layer* parent_layer) { |
| 318 // Reorder children to stack the last child layer at the top. Otherwise | 320 // Reorder children to stack the last child layer at the top. Otherwise |
| 319 // upper notification may be hidden by the lower one. | 321 // upper notification may be hidden by the lower one. |
| 320 for (int i = 0; i < child_count(); ++i) { | 322 for (int i = 0; i < child_count(); ++i) { |
| 321 if (child_at(i)->layer()) | 323 if (child_at(i)->layer()) |
| 322 parent_layer->StackAtBottom(child_at(i)->layer()); | 324 parent_layer->StackAtBottom(child_at(i)->layer()); |
| 323 } | 325 } |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 scroller_->InvalidateLayout(); | 994 scroller_->InvalidateLayout(); |
| 993 PreferredSizeChanged(); | 995 PreferredSizeChanged(); |
| 994 Layout(); | 996 Layout(); |
| 995 } | 997 } |
| 996 | 998 |
| 997 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { | 999 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { |
| 998 message_list_view_->AddNotificationAt(view, 0); | 1000 message_list_view_->AddNotificationAt(view, 0); |
| 999 } | 1001 } |
| 1000 | 1002 |
| 1001 } // namespace message_center | 1003 } // namespace message_center |
| OLD | NEW |