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/common/system/tray/tray_details_view.h" | 5 #include "ash/common/system/tray/tray_details_view.h" |
6 | 6 |
7 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 7 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
8 #include "ash/common/system/tray/system_tray_item.h" | 8 #include "ash/common/system/tray/system_tray_item.h" |
9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(ScrollBorder); | 59 DISALLOW_COPY_AND_ASSIGN(ScrollBorder); |
60 }; | 60 }; |
61 | 61 |
62 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) | 62 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
63 : owner_(owner), | 63 : owner_(owner), |
64 footer_(NULL), | 64 footer_(NULL), |
65 scroller_(NULL), | 65 scroller_(NULL), |
66 scroll_content_(NULL), | 66 scroll_content_(NULL), |
67 scroll_border_(NULL) { | 67 scroll_border_(NULL) { |
68 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, | 68 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
69 0, 0, 0)); | |
70 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 69 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); |
71 } | 70 } |
72 | 71 |
73 TrayDetailsView::~TrayDetailsView() { | 72 TrayDetailsView::~TrayDetailsView() {} |
74 } | |
75 | 73 |
76 void TrayDetailsView::CreateSpecialRow(int string_id, | 74 void TrayDetailsView::CreateSpecialRow(int string_id, |
77 ViewClickListener* listener) { | 75 ViewClickListener* listener) { |
78 DCHECK(!footer_); | 76 DCHECK(!footer_); |
79 footer_ = new SpecialPopupRow(); | 77 footer_ = new SpecialPopupRow(); |
80 footer_->SetTextLabel(string_id, listener); | 78 footer_->SetTextLabel(string_id, listener); |
81 AddChildViewAt(footer_, child_count()); | 79 AddChildViewAt(footer_, child_count()); |
82 } | 80 } |
83 | 81 |
84 void TrayDetailsView::CreateScrollableList() { | 82 void TrayDetailsView::CreateScrollableList() { |
85 DCHECK(!scroller_); | 83 DCHECK(!scroller_); |
86 scroll_content_ = new views::View; | 84 scroll_content_ = new views::View; |
87 scroll_content_->SetLayoutManager(new views::BoxLayout( | 85 scroll_content_->SetLayoutManager( |
88 views::BoxLayout::kVertical, 0, 0, 1)); | 86 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); |
89 scroller_ = new FixedSizedScrollView; | 87 scroller_ = new FixedSizedScrollView; |
90 scroller_->SetContentsView(scroll_content_); | 88 scroller_->SetContentsView(scroll_content_); |
91 | 89 |
92 // Note: |scroller_| takes ownership of |scroll_border_|. | 90 // Note: |scroller_| takes ownership of |scroll_border_|. |
93 scroll_border_ = new ScrollBorder; | 91 scroll_border_ = new ScrollBorder; |
94 scroller_->SetBorder(std::unique_ptr<views::Border>(scroll_border_)); | 92 scroller_->SetBorder(std::unique_ptr<views::Border>(scroll_border_)); |
95 | 93 |
96 AddChildView(scroller_); | 94 AddChildView(scroller_); |
97 } | 95 } |
98 | 96 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (index < child_count() - 1 && child_at(index + 1) != footer_) | 153 if (index < child_count() - 1 && child_at(index + 1) != footer_) |
156 scroll_border_->set_visible(true); | 154 scroll_border_->set_visible(true); |
157 else | 155 else |
158 scroll_border_->set_visible(false); | 156 scroll_border_->set_visible(false); |
159 } | 157 } |
160 | 158 |
161 views::View::OnPaintBorder(canvas); | 159 views::View::OnPaintBorder(canvas); |
162 } | 160 } |
163 | 161 |
164 } // namespace ash | 162 } // namespace ash |
OLD | NEW |