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