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

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

Issue 9594011: ash uber tray: Make the tray background rounded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | « no previous file | ash/wm/shelf_layout_manager.cc » ('j') | ash/wm/shelf_layout_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 89e421b56781c9715a17fc025ef82274aa32b27c..cef7f3525676a693dc6eacd3c752b221b4679a87 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -18,6 +18,7 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/skia_util.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/label.h"
@@ -38,6 +39,8 @@ const SkColor kLightColor = SkColorSetRGB(240, 240, 240);
const SkColor kBackgroundColor = SK_ColorWHITE;
const SkColor kShadowColor = SkColorSetARGB(25, 0, 0, 0);
+const SkColor kTrayBackgroundColor = SkColorSetARGB(127, 0, 0, 0);
+
class SystemTrayBubbleBackground : public views::Background {
public:
explicit SystemTrayBubbleBackground(views::View* owner)
@@ -194,6 +197,28 @@ class SystemTrayBubble : public views::BubbleDelegateView {
DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble);
};
+class SystemTrayBackground : public views::Background {
+ public:
+ SystemTrayBackground() {}
+ virtual ~SystemTrayBackground() {}
+
+ private:
+ // Overrridden from views::Background.
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setColor(kTrayBackgroundColor);
+ SkPath path;
+ gfx::Rect bounds(view->GetContentsBounds());
+ SkScalar radius = SkIntToScalar(4);
+ path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
+ canvas->GetSkCanvas()->drawPath(path, paint);
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(SystemTrayBackground);
+};
+
} // namespace
namespace ash {
@@ -203,8 +228,7 @@ SystemTray::SystemTray()
popup_(NULL) {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
5, 0, 3));
- set_background(views::Background::CreateSolidBackground(
- SkColorSetARGB(127, 0, 0, 0)));
+ set_background(new SystemTrayBackground);
}
SystemTray::~SystemTray() {
« no previous file with comments | « no previous file | ash/wm/shelf_layout_manager.cc » ('j') | ash/wm/shelf_layout_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698