| 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 } |
| 240 | 269 |
| 241 //////////////////////////////////////////////////////////////////////////////// | 270 //////////////////////////////////////////////////////////////////////////////// |
| 242 // TrayDetailsView: | 271 // TrayDetailsView: |
| 243 | 272 |
| 244 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) | 273 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
| 245 : owner_(owner), | 274 : owner_(owner), |
| 246 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), | 275 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), |
| 247 scroller_(nullptr), | 276 scroller_(nullptr), |
| 248 scroll_content_(nullptr), | 277 scroll_content_(nullptr), |
| 249 progress_bar_(nullptr), | 278 progress_bar_(nullptr), |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (bounds().IsEmpty()) | 501 if (bounds().IsEmpty()) |
| 473 return views::View::GetHeightForWidth(width); | 502 return views::View::GetHeightForWidth(width); |
| 474 | 503 |
| 475 // The height of the bubble that contains this detailed view is set to | 504 // 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 | 505 // the preferred height of the default view, and that determines the |
| 477 // initial height of |this|. Always request to stay the same height. | 506 // initial height of |this|. Always request to stay the same height. |
| 478 return height(); | 507 return height(); |
| 479 } | 508 } |
| 480 | 509 |
| 481 } // namespace ash | 510 } // namespace ash |
| OLD | NEW |