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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void UpdateNotification(MessageView* view, const Notification& notification); | 124 void UpdateNotification(MessageView* view, const Notification& notification); |
125 void SetRepositionTarget(const gfx::Rect& target_rect); | 125 void SetRepositionTarget(const gfx::Rect& target_rect); |
126 void ResetRepositionSession(); | 126 void ResetRepositionSession(); |
127 void ClearAllNotifications(const gfx::Rect& visible_scroll_rect); | 127 void ClearAllNotifications(const gfx::Rect& visible_scroll_rect); |
128 | 128 |
129 protected: | 129 protected: |
130 // Overridden from views::View. | 130 // Overridden from views::View. |
131 void Layout() override; | 131 void Layout() override; |
132 gfx::Size GetPreferredSize() const override; | 132 gfx::Size GetPreferredSize() const override; |
133 int GetHeightForWidth(int width) const override; | 133 int GetHeightForWidth(int width) const override; |
134 void PaintChildren(const PaintContext& context) override; | 134 void PaintChildren(const ui::PaintContext& context) override; |
135 void ReorderChildLayers(ui::Layer* parent_layer) override; | 135 void ReorderChildLayers(ui::Layer* parent_layer) override; |
136 | 136 |
137 // Overridden from views::BoundsAnimatorObserver. | 137 // Overridden from views::BoundsAnimatorObserver. |
138 void OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) override; | 138 void OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) override; |
139 void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override; | 139 void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override; |
140 | 140 |
141 private: | 141 private: |
142 bool IsValidChild(const views::View* child) const; | 142 bool IsValidChild(const views::View* child) const; |
143 void DoUpdateIfPossible(); | 143 void DoUpdateIfPossible(); |
144 | 144 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 const views::View* child = child_at(i); | 305 const views::View* child = child_at(i); |
306 if (!IsValidChild(child)) | 306 if (!IsValidChild(child)) |
307 continue; | 307 continue; |
308 height += child->GetHeightForWidth(width) + padding; | 308 height += child->GetHeightForWidth(width) + padding; |
309 padding = kMarginBetweenItems - MessageView::GetShadowInsets().bottom(); | 309 padding = kMarginBetweenItems - MessageView::GetShadowInsets().bottom(); |
310 } | 310 } |
311 | 311 |
312 return height + GetInsets().height(); | 312 return height + GetInsets().height(); |
313 } | 313 } |
314 | 314 |
315 void MessageListView::PaintChildren(const PaintContext& context) { | 315 void MessageListView::PaintChildren(const ui::PaintContext& context) { |
316 // Paint in the inversed order. Otherwise upper notification may be | 316 // Paint in the inversed order. Otherwise upper notification may be |
317 // hidden by the lower one. | 317 // hidden by the lower one. |
318 for (int i = child_count() - 1; i >= 0; --i) { | 318 for (int i = child_count() - 1; i >= 0; --i) { |
319 if (!child_at(i)->layer()) | 319 if (!child_at(i)->layer()) |
320 child_at(i)->Paint(context); | 320 child_at(i)->Paint(context); |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 void MessageListView::ReorderChildLayers(ui::Layer* parent_layer) { | 324 void MessageListView::ReorderChildLayers(ui::Layer* parent_layer) { |
325 // Reorder children to stack the last child layer at the top. Otherwise | 325 // Reorder children to stack the last child layer at the top. Otherwise |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 scroller_->InvalidateLayout(); | 1006 scroller_->InvalidateLayout(); |
1007 PreferredSizeChanged(); | 1007 PreferredSizeChanged(); |
1008 Layout(); | 1008 Layout(); |
1009 } | 1009 } |
1010 | 1010 |
1011 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { | 1011 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { |
1012 message_list_view_->AddNotificationAt(view, 0); | 1012 message_list_view_->AddNotificationAt(view, 0); |
1013 } | 1013 } |
1014 | 1014 |
1015 } // namespace message_center | 1015 } // namespace message_center |
OLD | NEW |