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" | 15 #include "ash/system/tray/fixed_sized_image_view.h" |
16 #include "ash/system/tray/hover_highlight_view.h" | 16 #include "ash/system/tray/hover_highlight_view.h" |
17 #include "ash/system/tray/size_range_layout.h" | 17 #include "ash/system/tray/size_range_layout.h" |
18 #include "ash/system/tray/tray_constants.h" | 18 #include "ash/system/tray/tray_constants.h" |
19 #include "ash/system/tray/tray_popup_item_style.h" | 19 #include "ash/system/tray/tray_popup_item_style.h" |
20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/gfx/color_palette.h" | 22 #include "ui/gfx/color_palette.h" |
23 #include "ui/gfx/paint_vector_icon.h" | 23 #include "ui/gfx/paint_vector_icon.h" |
| 24 #include "ui/native_theme/native_theme.h" |
24 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 25 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
25 #include "ui/views/animation/ink_drop_highlight.h" | 26 #include "ui/views/animation/ink_drop_highlight.h" |
26 #include "ui/views/animation/ink_drop_impl.h" | 27 #include "ui/views/animation/ink_drop_impl.h" |
27 #include "ui/views/animation/ink_drop_mask.h" | 28 #include "ui/views/animation/ink_drop_mask.h" |
28 #include "ui/views/animation/square_ink_drop_ripple.h" | 29 #include "ui/views/animation/square_ink_drop_ripple.h" |
29 #include "ui/views/background.h" | 30 #include "ui/views/background.h" |
30 #include "ui/views/border.h" | 31 #include "ui/views/border.h" |
31 #include "ui/views/controls/button/button.h" | 32 #include "ui/views/controls/button/button.h" |
32 #include "ui/views/controls/button/label_button.h" | 33 #include "ui/views/controls/button/label_button.h" |
33 #include "ui/views/controls/button/md_text_button.h" | 34 #include "ui/views/controls/button/md_text_button.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 221 } |
221 | 222 |
222 views::Label* TrayPopupUtils::CreateDefaultLabel() { | 223 views::Label* TrayPopupUtils::CreateDefaultLabel() { |
223 views::Label* label = new views::Label(); | 224 views::Label* label = new views::Label(); |
224 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 225 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
225 label->SetBorder( | 226 label->SetBorder( |
226 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); | 227 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); |
227 // Frequently the label will paint to a layer that's non-opaque, so subpixel | 228 // Frequently the label will paint to a layer that's non-opaque, so subpixel |
228 // rendering won't work unless we explicitly set a background. See | 229 // rendering won't work unless we explicitly set a background. See |
229 // crbug.com/686363 | 230 // crbug.com/686363 |
230 label->set_background( | 231 label->set_background(views::Background::CreateThemedSolidBackground( |
231 views::Background::CreateSolidBackground(kBackgroundColor)); | 232 label, ui::NativeTheme::kColorId_BubbleBackground)); |
232 label->SetBackgroundColor(kBackgroundColor); | |
233 return label; | 233 return label; |
234 } | 234 } |
235 | 235 |
236 views::ImageView* TrayPopupUtils::CreateMainImageView() { | 236 views::ImageView* TrayPopupUtils::CreateMainImageView() { |
237 return new FixedSizedImageView(kTrayPopupItemMinStartWidth, | 237 return new FixedSizedImageView(kTrayPopupItemMinStartWidth, |
238 kTrayPopupItemMinHeight); | 238 kTrayPopupItemMinHeight); |
239 } | 239 } |
240 | 240 |
241 views::ImageView* TrayPopupUtils::CreateMoreImageView() { | 241 views::ImageView* TrayPopupUtils::CreateMoreImageView() { |
242 views::ImageView* image = | 242 views::ImageView* image = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 button->SetFocusForPlatform(); | 281 button->SetFocusForPlatform(); |
282 | 282 |
283 button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); | 283 button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); |
284 button->set_has_ink_drop_action_on_click(true); | 284 button->set_has_ink_drop_action_on_click(true); |
285 button->set_ink_drop_base_color(kTrayPopupInkDropBaseColor); | 285 button->set_ink_drop_base_color(kTrayPopupInkDropBaseColor); |
286 button->set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); | 286 button->set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); |
287 } | 287 } |
288 | 288 |
289 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { | 289 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { |
290 view->set_id(VIEW_ID_STICKY_HEADER); | 290 view->set_id(VIEW_ID_STICKY_HEADER); |
291 view->set_background( | 291 view->set_background(views::Background::CreateThemedSolidBackground( |
292 views::Background::CreateSolidBackground(kBackgroundColor)); | 292 view, ui::NativeTheme::kColorId_BubbleBackground)); |
293 view->SetBorder( | 293 view->SetBorder( |
294 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); | 294 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); |
295 view->SetPaintToLayer(); | 295 view->SetPaintToLayer(); |
296 view->layer()->SetFillsBoundsOpaquely(false); | 296 view->layer()->SetFillsBoundsOpaquely(false); |
297 } | 297 } |
298 | 298 |
299 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view, | 299 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view, |
300 bool show_separator) { | 300 bool show_separator) { |
301 if (show_separator) { | 301 if (show_separator) { |
302 view->SetBorder(views::CreatePaddedBorder( | 302 view->SetBorder(views::CreatePaddedBorder( |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 457 |
458 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, | 458 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, |
459 bool visible) { | 459 bool visible) { |
460 container->SetRightViewVisible(visible); | 460 container->SetRightViewVisible(visible); |
461 container->SetAccessiblityState( | 461 container->SetAccessiblityState( |
462 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX | 462 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX |
463 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | 463 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); |
464 } | 464 } |
465 | 465 |
466 } // namespace ash | 466 } // namespace ash |
OLD | NEW |