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 916ebad4a9e117c7c565961293ed9e35dcf448b2..4b0acbcbd5a9efa41888e3ff7e7f0e3bd3393ec2 100644 |
--- a/chrome/browser/ui/views/toolbar/app_menu.cc |
+++ b/chrome/browser/ui/views/toolbar/app_menu.cc |
@@ -46,6 +46,7 @@ |
#include "third_party/skia/include/core/SkPaint.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/layout.h" |
+#include "ui/base/material_design/material_design_controller.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/font_list.h" |
@@ -163,12 +164,13 @@ class InMenuButtonBackground : public views::Background { |
// Normal buttons get a border drawn on the right side and the rest gets |
// filled in. The left button however does not get a line to combine |
// buttons. |
+ gfx::Rect bounds(view->GetLocalBounds()); |
if (type_ != RIGHT_BUTTON) { |
canvas->FillRect(gfx::Rect(0, 0, 1, h), |
BorderColor(view, views::Button::STATE_NORMAL)); |
+ bounds.Inset(gfx::Insets(0, 1, 0, 0)); |
} |
- gfx::Rect bounds(view->GetLocalBounds()); |
bounds.set_x(view->GetMirroredXForRect(bounds)); |
DrawBackground(canvas, view, bounds, state); |
} |
@@ -213,11 +215,16 @@ class InMenuButtonBackground : public views::Background { |
views::Button::ButtonState state) const { |
if (state == views::Button::STATE_HOVERED || |
state == views::Button::STATE_PRESSED) { |
+ ui::NativeTheme::ExtraParams params; |
+ if (ui::MaterialDesignController::IsModeMaterial() && |
+ view->GetClassName() == views::MenuButton::kViewClassName) { |
+ // Consistent with a hover corner radius (kInkDropSmallCornerRadius). |
+ const int kBackgroundCornerRadius = 2; |
+ params.menu_item.corner_radius = kBackgroundCornerRadius; |
+ } |
view->GetNativeTheme()->Paint(canvas->sk_canvas(), |
ui::NativeTheme::kMenuItemBackground, |
- ui::NativeTheme::kHovered, |
- bounds, |
- ui::NativeTheme::ExtraParams()); |
+ ui::NativeTheme::kHovered, bounds, params); |
} |
} |
@@ -1137,11 +1144,21 @@ void AppMenu::PopulateMenu(MenuItemView* parent, MenuModel* model) { |
case IDC_EXTENSIONS_OVERFLOW_MENU: { |
scoped_ptr<ExtensionToolbarMenuView> extension_toolbar( |
new ExtensionToolbarMenuView(browser_, this)); |
- extension_toolbar_ = extension_toolbar.get(); |
- if (extension_toolbar->ShouldShow()) |
- item->AddChildView(extension_toolbar.release()); |
- else |
+ if (!extension_toolbar->ShouldShow()) { |
item->SetVisible(false); |
+ extension_toolbar_ = nullptr; |
+ break; |
+ } |
+ if (ui::MaterialDesignController::IsModeMaterial()) { |
+ for (int i = 0; i < extension_toolbar->contents()->child_count(); |
+ ++i) { |
+ View* action_view = extension_toolbar->contents()->child_at(i); |
+ action_view->set_background(new InMenuButtonBackground( |
+ InMenuButtonBackground::RIGHT_BUTTON)); |
+ } |
+ } |
+ extension_toolbar_ = extension_toolbar.get(); |
+ item->AddChildView(extension_toolbar.release()); |
break; |
} |