OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/tray/tray_details_view.h" | 5 #include "ash/system/tray/tray_details_view.h" |
6 | 6 |
7 #include "ash/ash_view_ids.h" | 7 #include "ash/ash_view_ids.h" |
8 #include "ash/strings/grit/ash_strings.h" | 8 #include "ash/strings/grit/ash_strings.h" |
9 #include "ash/system/tray/hover_highlight_view.h" | 9 #include "ash/system/tray/hover_highlight_view.h" |
10 #include "ash/system/tray/system_menu_button.h" | 10 #include "ash/system/tray/system_menu_button.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SetLayoutManager(box_layout_); | 58 SetLayoutManager(box_layout_); |
59 } | 59 } |
60 ~ScrollContentsView() override {} | 60 ~ScrollContentsView() override {} |
61 | 61 |
62 protected: | 62 protected: |
63 // views::View: | 63 // views::View: |
64 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { | 64 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { |
65 PositionHeaderRows(); | 65 PositionHeaderRows(); |
66 } | 66 } |
67 | 67 |
68 void PaintChildren(const ui::PaintContext& context) override { | 68 void PaintChildren(const views::PaintInfo& paint_info) override { |
69 views::View::PaintChildren(context); | 69 views::View::PaintChildren(paint_info); |
70 bool did_draw_shadow = false; | 70 bool did_draw_shadow = false; |
71 // Paint header row separators. | 71 // Paint header row separators. |
72 for (auto& header : headers_) | 72 for (auto& header : headers_) |
73 did_draw_shadow = PaintDelineation(header, context) || did_draw_shadow; | 73 did_draw_shadow = |
| 74 PaintDelineation(header, paint_info.context()) || did_draw_shadow; |
74 | 75 |
75 // Draw a shadow at the top of the viewport when scrolled, but only if a | 76 // Draw a shadow at the top of the viewport when scrolled, but only if a |
76 // header didn't already draw one. Overlap the shadow with the separator | 77 // header didn't already draw one. Overlap the shadow with the separator |
77 // that's below the header view so we don't get both a separator and a full | 78 // that's below the header view so we don't get both a separator and a full |
78 // shadow. | 79 // shadow. |
79 if (y() != 0 && !did_draw_shadow) | 80 if (y() != 0 && !did_draw_shadow) |
80 DrawShadow(context, gfx::Rect(0, 0, width(), -y() - kSeparatorWidth)); | 81 DrawShadow(paint_info.context(), |
| 82 gfx::Rect(0, 0, width(), -y() - kSeparatorWidth)); |
81 } | 83 } |
82 | 84 |
83 void Layout() override { | 85 void Layout() override { |
84 views::View::Layout(); | 86 views::View::Layout(); |
85 headers_.clear(); | 87 headers_.clear(); |
86 for (int i = 0; i < child_count(); ++i) { | 88 for (int i = 0; i < child_count(); ++i) { |
87 views::View* view = child_at(i); | 89 views::View* view = child_at(i); |
88 if (view->id() == VIEW_ID_STICKY_HEADER) | 90 if (view->id() == VIEW_ID_STICKY_HEADER) |
89 headers_.emplace_back(view); | 91 headers_.emplace_back(view); |
90 } | 92 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 if (bounds().IsEmpty()) | 474 if (bounds().IsEmpty()) |
473 return views::View::GetHeightForWidth(width); | 475 return views::View::GetHeightForWidth(width); |
474 | 476 |
475 // The height of the bubble that contains this detailed view is set to | 477 // The height of the bubble that contains this detailed view is set to |
476 // the preferred height of the default view, and that determines the | 478 // the preferred height of the default view, and that determines the |
477 // initial height of |this|. Always request to stay the same height. | 479 // initial height of |this|. Always request to stay the same height. |
478 return height(); | 480 return height(); |
479 } | 481 } |
480 | 482 |
481 } // namespace ash | 483 } // namespace ash |
OLD | NEW |