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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 // Constants for the title row. | 231 // Constants for the title row. |
232 const int kTitleRowVerticalPadding = 4; | 232 const int kTitleRowVerticalPadding = 4; |
233 const int kTitleRowProgressBarHeight = 2; | 233 const int kTitleRowProgressBarHeight = 2; |
234 const int kTitleRowPaddingTop = kTitleRowVerticalPadding; | 234 const int kTitleRowPaddingTop = kTitleRowVerticalPadding; |
235 const int kTitleRowPaddingBottom = | 235 const int kTitleRowPaddingBottom = |
236 kTitleRowVerticalPadding - kTitleRowProgressBarHeight; | 236 kTitleRowVerticalPadding - kTitleRowProgressBarHeight; |
237 | 237 |
238 } // namespace | 238 } // namespace |
239 | 239 |
240 //////////////////////////////////////////////////////////////////////////////// | |
241 // TrayDetailsView::InfoLabel: | |
242 | |
243 TrayDetailsView::InfoLabel::InfoLabel(int message_id) | |
244 : label_(TrayPopupUtils::CreateDefaultLabel()) { | |
245 SetLayoutManager(new views::FillLayout); | |
246 | |
247 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO); | |
248 style.SetupLabel(label_); | |
249 | |
250 TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); | |
251 tri_view->SetInsets(gfx::Insets(0, | |
252 kMenuExtraMarginFromLeftEdge + | |
253 kTrayPopupPaddingHorizontal - | |
254 kTrayPopupLabelHorizontalPadding, | |
255 0, kTrayPopupPaddingHorizontal)); | |
256 tri_view->SetContainerVisible(TriView::Container::START, false); | |
257 tri_view->SetContainerVisible(TriView::Container::END, false); | |
258 tri_view->AddView(TriView::Container::CENTER, label_); | |
259 AddChildView(tri_view); | |
260 | |
261 SetMessage(message_id); | |
262 } | |
263 | |
264 TrayDetailsView::InfoLabel::~InfoLabel() {} | |
265 | |
266 void TrayDetailsView::InfoLabel::SetMessage(int message_id) { | |
267 label_->SetText(l10n_util::GetStringUTF16(message_id)); | |
268 } | |
269 | 240 |
270 //////////////////////////////////////////////////////////////////////////////// | 241 //////////////////////////////////////////////////////////////////////////////// |
271 // TrayDetailsView: | 242 // TrayDetailsView: |
272 | 243 |
273 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) | 244 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
274 : owner_(owner), | 245 : owner_(owner), |
275 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), | 246 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), |
276 scroller_(nullptr), | 247 scroller_(nullptr), |
277 scroll_content_(nullptr), | 248 scroll_content_(nullptr), |
278 progress_bar_(nullptr), | 249 progress_bar_(nullptr), |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (bounds().IsEmpty()) | 472 if (bounds().IsEmpty()) |
502 return views::View::GetHeightForWidth(width); | 473 return views::View::GetHeightForWidth(width); |
503 | 474 |
504 // The height of the bubble that contains this detailed view is set to | 475 // The height of the bubble that contains this detailed view is set to |
505 // the preferred height of the default view, and that determines the | 476 // the preferred height of the default view, and that determines the |
506 // initial height of |this|. Always request to stay the same height. | 477 // initial height of |this|. Always request to stay the same height. |
507 return height(); | 478 return height(); |
508 } | 479 } |
509 | 480 |
510 } // namespace ash | 481 } // namespace ash |
OLD | NEW |