Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ash/system/tray/tray_popup_utils.cc

Issue 2816193002: Introduce a type of View background that stays in sync with its host (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/system/tray/tray_details_view.cc ('k') | ash/system/tray_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 220 }
220 221
221 views::Label* TrayPopupUtils::CreateDefaultLabel() { 222 views::Label* TrayPopupUtils::CreateDefaultLabel() {
222 views::Label* label = new views::Label(); 223 views::Label* label = new views::Label();
223 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 224 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
224 label->SetBorder( 225 label->SetBorder(
225 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); 226 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding));
226 // 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
227 // rendering won't work unless we explicitly set a background. See 228 // rendering won't work unless we explicitly set a background. See
228 // crbug.com/686363 229 // crbug.com/686363
229 label->set_background( 230 label->set_background(views::Background::CreateThemedSolidBackground(
230 views::Background::CreateSolidBackground(kBackgroundColor)); 231 label, ui::NativeTheme::kColorId_BubbleBackground));
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
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( 290 view->set_background(views::Background::CreateThemedSolidBackground(
291 views::Background::CreateSolidBackground(kBackgroundColor)); 291 view, ui::NativeTheme::kColorId_BubbleBackground));
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
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
OLDNEW
« no previous file with comments | « ash/system/tray/tray_details_view.cc ('k') | ash/system/tray_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698