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

Unified Diff: ash/system/tray/tray_bubble_view.cc

Issue 10566003: ash: Fix arrow color for the uber-tray popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray/system_tray_bubble.cc ('k') | ash/system/tray/tray_views.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_bubble_view.cc
diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc
index 93d1e6dfa3e47223a1653c9c51f4fcd60b3e3386..707a34ba92a5cc3aae08e01ef45be001d5f43443 100644
--- a/ash/system/tray/tray_bubble_view.cc
+++ b/ash/system/tray/tray_bubble_view.cc
@@ -81,6 +81,15 @@ class TrayBubbleBorder : public views::BubbleBorder {
virtual ~TrayBubbleBorder() {}
private:
+ views::Background* FindAppropriateBackground(views::View* view,
+ const gfx::Point& point) const {
+ views::Background* background = NULL;
+ views::View* target = view->GetEventHandlerForPoint(point);
+ for (; target && !background; target = target->parent())
+ background = target->background();
+ return background;
+ }
+
// Overridden from views::BubbleBorder.
// Override views::BubbleBorder to set the bubble on top of the anchor when
// it has no arrow.
@@ -122,6 +131,8 @@ class TrayBubbleBorder : public views::BubbleBorder {
arrow_location() == views::BubbleBorder::NONE)
return;
+ gfx::Point arrow_reference;
+
// Draw the arrow after drawing child borders, so that the arrow can cover
// the its overlap section with child border.
SkPath path;
@@ -138,6 +149,7 @@ class TrayBubbleBorder : public views::BubbleBorder {
path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y));
path.lineTo(SkIntToScalar(left_base_x + kArrowWidth),
SkIntToScalar(left_base_y));
+ arrow_reference.SetPoint(tip_x, left_base_y - kArrowHeight);
} else {
int tip_y = y - tray_arrow_offset_;
tip_y = std::min(std::max(kArrowMinOffset, tip_y),
@@ -147,11 +159,13 @@ class TrayBubbleBorder : public views::BubbleBorder {
if (arrow_location() == views::BubbleBorder::LEFT_BOTTOM) {
top_base_x = inset.left() + kSystemTrayBubbleHorizontalInset;
tip_x = top_base_x - kArrowHeight;
+ arrow_reference.SetPoint(top_base_x + kArrowHeight, tip_y);
} else {
DCHECK(arrow_location() == views::BubbleBorder::RIGHT_BOTTOM);
top_base_x = inset.left() + owner_->width() -
kSystemTrayBubbleHorizontalInset;
tip_x = top_base_x + kArrowHeight;
+ arrow_reference.SetPoint(top_base_x - kArrowHeight, tip_y);
}
path.moveTo(SkIntToScalar(top_base_x), SkIntToScalar(top_base_y));
path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y));
@@ -159,9 +173,12 @@ class TrayBubbleBorder : public views::BubbleBorder {
SkIntToScalar(top_base_y + kArrowWidth));
}
+ views::Background* background = FindAppropriateBackground(owner_,
+ arrow_reference);
+
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(kHeaderBackgroundColorDark);
+ paint.setColor(background ? background->get_color() : kBackgroundColor);
canvas->DrawPath(path, paint);
// Now draw the arrow border.
« no previous file with comments | « ash/system/tray/system_tray_bubble.cc ('k') | ash/system/tray/tray_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698