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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 2813703003: Use NativeTheme to draw vertical menu separators. (Closed)
Patch Set: use rectf Created 3 years, 8 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 | « chrome/browser/ui/libgtkui/native_theme_gtk3.cc ('k') | ui/base/models/menu_separator_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/app_menu.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu.cc b/chrome/browser/ui/views/toolbar/app_menu.cc
index 0309da713eaf67d859522da394a333acbe45e620..9b6ffe2619382ea51aea3a989018b6cf16f72927 100644
--- a/chrome/browser/ui/views/toolbar/app_menu.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu.cc
@@ -154,8 +154,6 @@ class InMenuButtonBackground : public views::Background {
// Overridden from views::Background.
void Paint(gfx::Canvas* canvas, View* view) const override {
CustomButton* button = CustomButton::AsCustomButton(view);
- views::Button::ButtonState state =
- button ? button->state() : views::Button::STATE_NORMAL;
int h = view->height();
// Draw leading border if desired.
@@ -165,32 +163,26 @@ class InMenuButtonBackground : public views::Background {
// already, so we end up flipping exactly once.
gfx::ScopedRTLFlipCanvas scoped_canvas(
canvas, view->width(), !view->flip_canvas_on_paint_for_rtl_ui());
- canvas->FillRect(gfx::Rect(0, 0, 1, h),
- BorderColor(view, views::Button::STATE_NORMAL));
- bounds.Inset(gfx::Insets(0, 1, 0, 0));
+ ui::NativeTheme::ExtraParams params;
+ gfx::Rect separator_bounds =
+ gfx::Rect(0, 0, MenuConfig::instance().separator_thickness, h);
+ params.menu_separator.paint_rect = &separator_bounds;
+ params.menu_separator.type = ui::VERTICAL_SEPARATOR;
+ view->GetNativeTheme()->Paint(
+ canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator,
+ ui::NativeTheme::kNormal, separator_bounds, params);
+ bounds.Inset(
+ gfx::Insets(0, MenuConfig::instance().separator_thickness, 0, 0));
}
// Fill in background for state.
bounds.set_x(view->GetMirroredXForRect(bounds));
+ views::Button::ButtonState state =
+ button ? button->state() : views::Button::STATE_NORMAL;
DrawBackground(canvas, view, bounds, state);
}
private:
- static SkColor BorderColor(View* view, views::Button::ButtonState state) {
- ui::NativeTheme* theme = view->GetNativeTheme();
- switch (state) {
- case views::Button::STATE_HOVERED:
- return theme->GetSystemColor(
- ui::NativeTheme::kColorId_HoverMenuButtonBorderColor);
- case views::Button::STATE_PRESSED:
- return theme->GetSystemColor(
- ui::NativeTheme::kColorId_FocusedMenuButtonBorderColor);
- default:
- return theme->GetSystemColor(
- ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor);
- }
- }
-
static SkColor BackgroundColor(const View* view,
views::Button::ButtonState state) {
const ui::NativeTheme* theme = view->GetNativeTheme();
« no previous file with comments | « chrome/browser/ui/libgtkui/native_theme_gtk3.cc ('k') | ui/base/models/menu_separator_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698