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

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: Addressed review 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..d89050a66802a63aaf16e78343c25d046e810ac2 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"
sky 2012/08/21 03:03:25 remove this import
Mr4D (OOO till 08-26) 2012/08/21 15:37:16 Done.
#include "ui/base/native_theme/native_theme.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/menu/menu_config.h"
@@ -18,14 +19,32 @@ 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::UPPER_SEPARATOR) {
+ canvas->FillRect(gfx::Rect(0, 0, width(), kSeparatorHeight),
+ ui::NativeTheme::instance()->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor));
+ } else if (type_ == ui::LOWER_SEPARATOR) {
+ canvas->FillRect(gfx::Rect(0,
+ height() - kSeparatorHeight,
+ width(),
+ kSeparatorHeight),
+ ui::NativeTheme::instance()->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor));
+ } else if (type_ != ui::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;
sky 2012/08/21 03:03:25 Add 3 constants for the specific separator types.
Mr4D (OOO till 08-26) 2012/08/21 15:37:16 Done.
+ if (type_ == ui::SPACING_SEPARATOR)
+ height = (height - kSeparatorHeight) / 2;
+ else if (type_ == ui::UPPER_SEPARATOR || type_ == ui::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