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

Side by Side Diff: ash/common/shelf/shelf_tooltip_manager.cc

Issue 2460103002: CrOS - Fix text background of shelf tooltips. (Closed)
Patch Set: docs Created 4 years, 1 month 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 | « no previous file | ui/views/bubble/bubble_dialog_delegate.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/shelf/shelf_tooltip_manager.h" 5 #include "ash/common/shelf/shelf_tooltip_manager.h"
6 6
7 #include "ash/common/shelf/shelf_view.h" 7 #include "ash/common/shelf/shelf_view.h"
8 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/wm_lookup.h" 10 #include "ash/common/wm_lookup.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 SetLayoutManager(new views::FillLayout()); 70 SetLayoutManager(new views::FillLayout());
71 views::Label* label = new views::Label(text); 71 views::Label* label = new views::Label(text);
72 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 72 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
73 ui::NativeTheme* theme = anchor->GetWidget()->GetNativeTheme(); 73 ui::NativeTheme* theme = anchor->GetWidget()->GetNativeTheme();
74 label->SetEnabledColor( 74 label->SetEnabledColor(
75 theme->GetSystemColor(ui::NativeTheme::kColorId_TooltipText)); 75 theme->GetSystemColor(ui::NativeTheme::kColorId_TooltipText));
76 SkColor background_color = 76 SkColor background_color =
77 theme->GetSystemColor(ui::NativeTheme::kColorId_TooltipBackground); 77 theme->GetSystemColor(ui::NativeTheme::kColorId_TooltipBackground);
78 set_color(background_color); 78 set_color(background_color);
79 label->SetBackgroundColor(background_color); 79 label->SetBackgroundColor(background_color);
80 // The background is not opaque, so we can't do subpixel rendering.
81 label->SetSubpixelRenderingEnabled(false);
80 AddChildView(label); 82 AddChildView(label);
81 // The bubble border has its own background so the background created by the
82 // BubbleDialogDelegateView is redundant and would cause extra opacity.
83 set_background(nullptr);
84 83
85 gfx::Insets insets(kArrowTopBottomOffset, kArrowLeftRightOffset); 84 gfx::Insets insets(kArrowTopBottomOffset, kArrowLeftRightOffset);
86 // Adjust the anchor location for asymmetrical borders of shelf item. 85 // Adjust the anchor location for asymmetrical borders of shelf item.
87 if (anchor->border()) 86 if (anchor->border())
88 insets += anchor->border()->GetInsets(); 87 insets += anchor->border()->GetInsets();
89 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 88 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
90 insets += gfx::Insets(-kBubblePaddingHorizontalBottom); 89 insets += gfx::Insets(-kBubblePaddingHorizontalBottom);
91 set_anchor_view_insets(insets); 90 set_anchor_view_insets(insets);
92 91
93 views::BubbleDialogDelegateView::CreateBubble(this); 92 views::BubbleDialogDelegateView::CreateBubble(this);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 258
260 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { 259 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) {
261 WmShelf* shelf = shelf_view_ ? shelf_view_->wm_shelf() : nullptr; 260 WmShelf* shelf = shelf_view_ ? shelf_view_->wm_shelf() : nullptr;
262 return shelf && shelf_view_->ShouldShowTooltipForView(view) && 261 return shelf && shelf_view_->ShouldShowTooltipForView(view) &&
263 (shelf->GetVisibilityState() == SHELF_VISIBLE || 262 (shelf->GetVisibilityState() == SHELF_VISIBLE ||
264 (shelf->GetVisibilityState() == SHELF_AUTO_HIDE && 263 (shelf->GetVisibilityState() == SHELF_AUTO_HIDE &&
265 shelf->GetAutoHideState() == SHELF_AUTO_HIDE_SHOWN)); 264 shelf->GetAutoHideState() == SHELF_AUTO_HIDE_SHOWN));
266 } 265 }
267 266
268 } // namespace ash 267 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698