summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 17:16:13 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 17:16:13 +0000
commit17c82582979fb65ea46d84c4e014efe6d7705166 (patch)
treef1f5d2a946ce025215f6997fd3a8d9206be1aa50 /views
parent27ad98351b503a436de21c76c2e7944451b620a3 (diff)
downloadchromium_src-17c82582979fb65ea46d84c4e014efe6d7705166.zip
chromium_src-17c82582979fb65ea46d84c4e014efe6d7705166.tar.gz
chromium_src-17c82582979fb65ea46d84c4e014efe6d7705166.tar.bz2
Make views menu have a similar look and feel of native menu on ChromeOS:
- Mark menu host popup with GDK_WINDOW_TYPE_HINT_MENU so that window manager would add drop shadow and border to it; - Use the same gradient fill as menu's background; - Use the same selection color and text color; BUG=<http://crosbug.com/1885> TEST=Verify bookmark menu have a similar look and feel as other menus (e.g. wrench menu). Review URL: http://codereview.chromium.org/1547030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_host_gtk.cc2
-rw-r--r--views/controls/menu/menu_item_view_gtk.cc9
-rw-r--r--views/controls/menu/menu_scroll_view_container.cc31
3 files changed, 42 insertions, 0 deletions
diff --git a/views/controls/menu/menu_host_gtk.cc b/views/controls/menu/menu_host_gtk.cc
index 38945e5..bdd8ffe 100644
--- a/views/controls/menu/menu_host_gtk.cc
+++ b/views/controls/menu/menu_host_gtk.cc
@@ -34,6 +34,8 @@ void MenuHost::Init(gfx::NativeWindow parent,
View* contents_view,
bool do_capture) {
WidgetGtk::Init(GTK_WIDGET(parent), bounds);
+ gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()),
+ GDK_WINDOW_TYPE_HINT_MENU);
SetContentsView(contents_view);
Show();
if (do_capture)
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index 9b2095c..a4c7216 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -15,7 +15,11 @@
namespace views {
// Background color when the menu item is selected.
+#if defined(OS_CHROMOS)
+static const SkColor kSelectedBackgroundColor = SkColorSetRGB(0xDC, 0xE4, 0xFA);
+#else
static const SkColor kSelectedBackgroundColor = SkColorSetRGB(246, 249, 253);
+#endif
gfx::Size MenuItemView::GetPreferredSize() {
const gfx::Font& font = MenuConfig::instance().font;
@@ -59,8 +63,13 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
}
// Render the foreground.
+#if defined(OS_CHROMEOS)
+ SkColor fg_color =
+ IsEnabled() ? SK_ColorBLACK : SkColorSetRGB(0x80, 0x80, 0x80);
+#else
SkColor fg_color =
IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor;
+#endif
int width = this->width() - item_right_margin_ - label_start_;
const gfx::Font& font = MenuConfig::instance().font;
gfx::Rect text_bounds(label_start_, top_margin +
diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc
index a80424e..7052206 100644
--- a/views/controls/menu/menu_scroll_view_container.cc
+++ b/views/controls/menu/menu_scroll_view_container.cc
@@ -13,6 +13,7 @@
#include "gfx/canvas.h"
#include "gfx/color_utils.h"
#include "views/border.h"
+#include "third_party/skia/include/effects/SkGradientShader.h"
#include "views/controls/menu/menu_config.h"
#include "views/controls/menu/menu_controller.h"
#include "views/controls/menu/menu_item_view.h"
@@ -184,6 +185,36 @@ void MenuScrollViewContainer::Paint(gfx::Canvas* canvas) {
NativeTheme::instance()->PaintMenuBackground(
NativeTheme::MENU, dc, MENU_POPUPBACKGROUND, 0, &bounds);
canvas->endPlatformPaint();
+#elif defined(OS_CHROMEOS)
+ static const SkColor kGradientColors[3] = {
+ SK_ColorWHITE,
+ SK_ColorWHITE,
+ SkColorSetRGB(0xD8, 0xD8, 0xD8)
+ };
+
+ static const SkScalar kGradientPoints[3] = {
+ SkIntToScalar(0),
+ SkDoubleToScalar(0.5),
+ SkIntToScalar(1)
+ };
+
+ SkPoint points[2];
+ points[0].set(SkIntToScalar(0), SkIntToScalar(0));
+ points[1].set(SkIntToScalar(0), SkIntToScalar(height()));
+
+ SkShader* shader = SkGradientShader::CreateLinear(points,
+ kGradientColors, kGradientPoints, arraysize(kGradientPoints),
+ SkShader::kRepeat_TileMode);
+ DCHECK(shader);
+
+ SkPaint paint;
+ paint.setShader(shader);
+ shader->unref();
+
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+
+ canvas->FillRectInt(0, 0, width(), height(), paint);
#else
// This is the same as COLOR_TOOLBAR.
canvas->drawColor(SkColorSetRGB(210, 225, 246), SkXfermode::kSrc_Mode);