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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 205 } |
205 | 206 |
206 views::Label* TrayPopupUtils::CreateDefaultLabel() { | 207 views::Label* TrayPopupUtils::CreateDefaultLabel() { |
207 views::Label* label = new views::Label(); | 208 views::Label* label = new views::Label(); |
208 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 209 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
209 label->SetBorder( | 210 label->SetBorder( |
210 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); | 211 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); |
211 // Frequently the label will paint to a layer that's non-opaque, so subpixel | 212 // Frequently the label will paint to a layer that's non-opaque, so subpixel |
212 // rendering won't work unless we explicitly set a background. See | 213 // rendering won't work unless we explicitly set a background. See |
213 // crbug.com/686363 | 214 // crbug.com/686363 |
214 label->set_background( | 215 label->set_background(views::Background::CreateThemedSolidBackground( |
215 views::Background::CreateSolidBackground(kBackgroundColor)); | 216 label, ui::NativeTheme::kColorId_BubbleBackground)); |
216 label->SetBackgroundColor(kBackgroundColor); | |
217 return label; | 217 return label; |
218 } | 218 } |
219 | 219 |
220 views::ImageView* TrayPopupUtils::CreateMainImageView() { | 220 views::ImageView* TrayPopupUtils::CreateMainImageView() { |
221 return new FixedSizedImageView(kTrayPopupItemMinStartWidth, | 221 return new FixedSizedImageView(kTrayPopupItemMinStartWidth, |
222 kTrayPopupItemMinHeight); | 222 kTrayPopupItemMinHeight); |
223 } | 223 } |
224 | 224 |
225 views::ImageView* TrayPopupUtils::CreateMoreImageView() { | 225 views::ImageView* TrayPopupUtils::CreateMoreImageView() { |
226 views::ImageView* image = | 226 views::ImageView* image = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 button->SetFocusForPlatform(); | 265 button->SetFocusForPlatform(); |
266 | 266 |
267 button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); | 267 button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); |
268 button->set_has_ink_drop_action_on_click(true); | 268 button->set_has_ink_drop_action_on_click(true); |
269 button->set_ink_drop_base_color(kTrayPopupInkDropBaseColor); | 269 button->set_ink_drop_base_color(kTrayPopupInkDropBaseColor); |
270 button->set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); | 270 button->set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); |
271 } | 271 } |
272 | 272 |
273 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { | 273 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { |
274 view->set_id(VIEW_ID_STICKY_HEADER); | 274 view->set_id(VIEW_ID_STICKY_HEADER); |
275 view->set_background( | 275 view->set_background(views::Background::CreateThemedSolidBackground( |
276 views::Background::CreateSolidBackground(kBackgroundColor)); | 276 view, ui::NativeTheme::kColorId_BubbleBackground)); |
277 view->SetBorder( | 277 view->SetBorder( |
278 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); | 278 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); |
279 view->SetPaintToLayer(); | 279 view->SetPaintToLayer(); |
280 view->layer()->SetFillsBoundsOpaquely(false); | 280 view->layer()->SetFillsBoundsOpaquely(false); |
281 } | 281 } |
282 | 282 |
283 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view, | 283 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view, |
284 bool show_separator) { | 284 bool show_separator) { |
285 if (show_separator) { | 285 if (show_separator) { |
286 view->SetBorder(views::CreatePaddedBorder( | 286 view->SetBorder(views::CreatePaddedBorder( |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, | 442 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, |
443 bool visible) { | 443 bool visible) { |
444 container->SetRightViewVisible(visible); | 444 container->SetRightViewVisible(visible); |
445 container->SetAccessiblityState( | 445 container->SetAccessiblityState( |
446 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX | 446 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX |
447 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | 447 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); |
448 } | 448 } |
449 | 449 |
450 } // namespace ash | 450 } // namespace ash |
OLD | NEW |