| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_popup_utils.h" | 5 #include "ash/system/tray/tray_popup_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| 11 #include "ash/ash_view_ids.h" | 11 #include "ash/ash_view_ids.h" |
| 12 #include "ash/resources/vector_icons/vector_icons.h" | 12 #include "ash/resources/vector_icons/vector_icons.h" |
| 13 #include "ash/session/session_controller.h" | 13 #include "ash/session/session_controller.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/system/tray/fixed_sized_image_view.h" | |
| 16 #include "ash/system/tray/hover_highlight_view.h" | 15 #include "ash/system/tray/hover_highlight_view.h" |
| 17 #include "ash/system/tray/size_range_layout.h" | 16 #include "ash/system/tray/size_range_layout.h" |
| 18 #include "ash/system/tray/tray_constants.h" | 17 #include "ash/system/tray/tray_constants.h" |
| 19 #include "ash/system/tray/tray_popup_item_style.h" | 18 #include "ash/system/tray/tray_popup_item_style.h" |
| 20 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/gfx/color_palette.h" | 21 #include "ui/gfx/color_palette.h" |
| 23 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
| 24 #include "ui/native_theme/native_theme.h" | 23 #include "ui/native_theme/native_theme.h" |
| 25 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 24 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); | 226 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); |
| 228 // Frequently the label will paint to a layer that's non-opaque, so subpixel | 227 // Frequently the label will paint to a layer that's non-opaque, so subpixel |
| 229 // rendering won't work unless we explicitly set a background. See | 228 // rendering won't work unless we explicitly set a background. See |
| 230 // crbug.com/686363 | 229 // crbug.com/686363 |
| 231 label->set_background(views::Background::CreateThemedSolidBackground( | 230 label->set_background(views::Background::CreateThemedSolidBackground( |
| 232 label, ui::NativeTheme::kColorId_BubbleBackground)); | 231 label, ui::NativeTheme::kColorId_BubbleBackground)); |
| 233 return label; | 232 return label; |
| 234 } | 233 } |
| 235 | 234 |
| 236 views::ImageView* TrayPopupUtils::CreateMainImageView() { | 235 views::ImageView* TrayPopupUtils::CreateMainImageView() { |
| 237 return new FixedSizedImageView(kTrayPopupItemMinStartWidth, | 236 auto* image = new views::ImageView; |
| 238 kTrayPopupItemMinHeight); | 237 image->set_preferred_size( |
| 238 gfx::Size(kTrayPopupItemMinStartWidth, kTrayPopupItemMinHeight)); |
| 239 return image; |
| 239 } | 240 } |
| 240 | 241 |
| 241 views::ImageView* TrayPopupUtils::CreateMoreImageView() { | 242 views::ImageView* TrayPopupUtils::CreateMoreImageView() { |
| 242 views::ImageView* image = | 243 auto* image = new views::ImageView; |
| 243 new FixedSizedImageView(kMenuIconSize, kMenuIconSize); | 244 image->set_preferred_size(gfx::Size(gfx::Size(kMenuIconSize, kMenuIconSize))); |
| 244 image->EnableCanvasFlippingForRTLUI(true); | 245 image->EnableCanvasFlippingForRTLUI(true); |
| 245 image->SetImage( | 246 image->SetImage( |
| 246 gfx::CreateVectorIcon(kSystemMenuArrowRightIcon, kMenuIconColor)); | 247 gfx::CreateVectorIcon(kSystemMenuArrowRightIcon, kMenuIconColor)); |
| 247 return image; | 248 return image; |
| 248 } | 249 } |
| 249 | 250 |
| 250 views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) { | 251 views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) { |
| 251 views::Slider* slider = new views::Slider(listener); | 252 views::Slider* slider = new views::Slider(listener); |
| 252 slider->SetBorder(views::CreateEmptyBorder(gfx::Insets(0, 16))); | 253 slider->SetBorder(views::CreateEmptyBorder(gfx::Insets(0, 16))); |
| 253 return slider; | 254 return slider; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 458 |
| 458 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, | 459 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, |
| 459 bool visible) { | 460 bool visible) { |
| 460 container->SetRightViewVisible(visible); | 461 container->SetRightViewVisible(visible); |
| 461 container->SetAccessiblityState( | 462 container->SetAccessiblityState( |
| 462 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX | 463 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX |
| 463 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | 464 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); |
| 464 } | 465 } |
| 465 | 466 |
| 466 } // namespace ash | 467 } // namespace ash |
| OLD | NEW |