Chromium Code Reviews| 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" |
| 11 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/system/tray/system_tray_item.h" | 12 #include "ash/system/tray/system_tray_item.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/system/tray/tray_popup_item_style.h" | 14 #include "ash/system/tray/tray_popup_item_style.h" |
| 15 #include "ash/system/tray/tray_popup_utils.h" | 15 #include "ash/system/tray/tray_popup_utils.h" |
| 16 #include "ash/system/tray/tri_view.h" | 16 #include "ash/system/tray/tri_view.h" |
| 17 #include "base/containers/adapters.h" | 17 #include "base/containers/adapters.h" |
| 18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 19 #include "third_party/skia/include/core/SkDrawLooper.h" | 19 #include "third_party/skia/include/core/SkDrawLooper.h" |
| 20 #include "ui/accessibility/ax_node_data.h" | |
|
Kyle Horimoto
2017/07/12 22:45:58
Remove.
lesliewatkins
2017/07/13 22:12:47
Done.
| |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/compositor/paint_context.h" | 23 #include "ui/compositor/paint_context.h" |
| 23 #include "ui/compositor/paint_recorder.h" | 24 #include "ui/compositor/paint_recorder.h" |
| 24 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| 25 #include "ui/gfx/geometry/insets.h" | 26 #include "ui/gfx/geometry/insets.h" |
| 26 #include "ui/gfx/image/image_skia.h" | 27 #include "ui/gfx/image/image_skia.h" |
| 27 #include "ui/gfx/paint_vector_icon.h" | 28 #include "ui/gfx/paint_vector_icon.h" |
| 28 #include "ui/gfx/skia_paint_util.h" | 29 #include "ui/gfx/skia_paint_util.h" |
| 29 #include "ui/gfx/vector_icon_types.h" | 30 #include "ui/gfx/vector_icon_types.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 231 |
| 231 // Constants for the title row. | 232 // Constants for the title row. |
| 232 const int kTitleRowVerticalPadding = 4; | 233 const int kTitleRowVerticalPadding = 4; |
| 233 const int kTitleRowProgressBarHeight = 2; | 234 const int kTitleRowProgressBarHeight = 2; |
| 234 const int kTitleRowPaddingTop = kTitleRowVerticalPadding; | 235 const int kTitleRowPaddingTop = kTitleRowVerticalPadding; |
| 235 const int kTitleRowPaddingBottom = | 236 const int kTitleRowPaddingBottom = |
| 236 kTitleRowVerticalPadding - kTitleRowProgressBarHeight; | 237 kTitleRowVerticalPadding - kTitleRowProgressBarHeight; |
| 237 | 238 |
| 238 } // namespace | 239 } // namespace |
| 239 | 240 |
| 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 | 241 |
| 270 //////////////////////////////////////////////////////////////////////////////// | 242 //////////////////////////////////////////////////////////////////////////////// |
| 271 // TrayDetailsView: | 243 // TrayDetailsView: |
| 272 | 244 |
| 273 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) | 245 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
| 274 : owner_(owner), | 246 : owner_(owner), |
| 275 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), | 247 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical)), |
| 276 scroller_(nullptr), | 248 scroller_(nullptr), |
| 277 scroll_content_(nullptr), | 249 scroll_content_(nullptr), |
| 278 progress_bar_(nullptr), | 250 progress_bar_(nullptr), |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 if (bounds().IsEmpty()) | 473 if (bounds().IsEmpty()) |
| 502 return views::View::GetHeightForWidth(width); | 474 return views::View::GetHeightForWidth(width); |
| 503 | 475 |
| 504 // The height of the bubble that contains this detailed view is set to | 476 // 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 | 477 // the preferred height of the default view, and that determines the |
| 506 // initial height of |this|. Always request to stay the same height. | 478 // initial height of |this|. Always request to stay the same height. |
| 507 return height(); | 479 return height(); |
| 508 } | 480 } |
| 509 | 481 |
| 510 } // namespace ash | 482 } // namespace ash |
| OLD | NEW |