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

Unified Diff: ui/views/controls/menu/menu_item_view_views.cc

Issue 9101004: Factor more colors into NativeTheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 11 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 | « ui/views/controls/menu/menu_item_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_item_view_views.cc
diff --git a/ui/views/controls/menu/menu_item_view_views.cc b/ui/views/controls/menu/menu_item_view_views.cc
index 1b77e2739512ac83fec8717f1e4097baf8802525..277196d7ab05a08cb30c2a67b26b0cccb15e41ea 100644
--- a/ui/views/controls/menu/menu_item_view_views.cc
+++ b/ui/views/controls/menu/menu_item_view_views.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,20 +10,13 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/favicon_size.h"
-#include "ui/views/controls/button/text_button.h"
+#include "ui/gfx/native_theme.h"
#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_image_util.h"
#include "ui/views/controls/menu/submenu_view.h"
namespace views {
-// Background color when the menu item is selected.
-#if defined(OS_CHROMEOS)
-static const SkColor kSelectedBackgroundColor = SkColorSetRGB(0xDC, 0xE4, 0xFA);
-#else
-static const SkColor kSelectedBackgroundColor = SkColorSetRGB(246, 249, 253);
-#endif
-
void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
const MenuConfig& config = MenuConfig::instance();
bool render_selection =
@@ -42,9 +35,11 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
// Render the background. As MenuScrollViewContainer draws the background, we
// only need the background when we want it to look different, as when we're
// selected.
- if (render_selection)
- canvas->GetSkCanvas()->drawColor(kSelectedBackgroundColor,
- SkXfermode::kSrc_Mode);
+ if (render_selection) {
+ SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor(
+ gfx::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
+ canvas->GetSkCanvas()->drawColor(bg_color, SkXfermode::kSrc_Mode);
+ }
// Render the check.
if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) {
@@ -68,13 +63,10 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
}
// Render the foreground.
-#if defined(OS_CHROMEOS)
- SkColor fg_color = enabled() ? SK_ColorBLACK
- : SkColorSetRGB(0x80, 0x80, 0x80);
-#else
- SkColor fg_color = enabled() ? TextButton::kEnabledColor
- : TextButton::kDisabledColor;
-#endif
+ SkColor fg_color = gfx::NativeTheme::instance()->GetSystemColor(
+ enabled() ? gfx::NativeTheme::kColorId_EnabledMenuItemForegroundColor
+ : gfx::NativeTheme::kColorId_DisabledMenuItemForegroundColor);
+
const gfx::Font& font = GetFont();
int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
int width = this->width() - item_right_margin_ - label_start_ - accel_width;
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698