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

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

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
Index: ui/views/controls/menu/menu_separator_views.cc
diff --git a/ui/views/controls/menu/menu_separator_views.cc b/ui/views/controls/menu/menu_separator_views.cc
index 61ec07d4bd12a2f3318c175e64823ddaf7ce17cc..b36945d79f6bf79c3693c2e257e5c7b1304a8ab7 100644
--- a/ui/views/controls/menu/menu_separator_views.cc
+++ b/ui/views/controls/menu/menu_separator_views.cc
@@ -5,6 +5,7 @@
#include "ui/views/controls/menu/menu_separator.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/models/menu_model.h"
#include "ui/base/native_theme/native_theme.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/menu/menu_config.h"
@@ -18,14 +19,33 @@ const int kSeparatorHeight = 1;
namespace views {
void MenuSeparator::OnPaint(gfx::Canvas* canvas) {
- canvas->FillRect(gfx::Rect(0, height() / 2, width(), kSeparatorHeight),
- ui::NativeTheme::instance()->GetSystemColor(
- ui::NativeTheme::kColorId_MenuSeparatorColor));
+ if (type_ == ui::MenuModel::UPPER_SEPARATOR) {
+ canvas->FillRect(gfx::Rect(0, 0, width(), kSeparatorHeight),
+ ui::NativeTheme::instance()->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor));
+ } else if (type_ == ui::MenuModel::LOWER_SEPARATOR) {
+ canvas->FillRect(gfx::Rect(0,
+ height() - kSeparatorHeight,
+ width(),
+ kSeparatorHeight),
+ ui::NativeTheme::instance()->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor));
+ } else if (type_ != ui::MenuModel::SPACING_SEPARATOR) {
+ canvas->FillRect(gfx::Rect(0, height() / 2, width(), kSeparatorHeight),
+ ui::NativeTheme::instance()->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor));
+ }
}
gfx::Size MenuSeparator::GetPreferredSize() {
+ int height = MenuConfig::instance().separator_height;
+ if (type_ == ui::MenuModel::SPACING_SEPARATOR)
+ height = (height - kSeparatorHeight) / 2;
+ else if (type_ == ui::MenuModel::UPPER_SEPARATOR ||
+ type_ == ui::MenuModel::LOWER_SEPARATOR)
+ height = (height - kSeparatorHeight) / 2 + kSeparatorHeight;
return gfx::Size(10, // Just in case we're the only item in a menu.
- MenuConfig::instance().separator_height);
+ height);
}
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698