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

Unified Diff: ui/views/style/platform_style.cc

Issue 1270343004: Update LabelButtons in the Toolbar for Material Design (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/style/platform_style.cc
diff --git a/ui/views/style/platform_style.cc b/ui/views/style/platform_style.cc
index c2179df3f4a5f0209bc28227ece5941e9639471a..520ececb549a22bf780c8f313808b4ec5b40ba85 100644
--- a/ui/views/style/platform_style.cc
+++ b/ui/views/style/platform_style.cc
@@ -4,16 +4,39 @@
#include "ui/views/style/platform_style.h"
+#include "ui/base/resource/material_design/material_design_controller.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/label_button_border.h"
namespace views {
-#if !defined(OS_MACOSX)
+#if defined(OS_CHROMEOS)
// static
scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
Button::ButtonStyle style) {
- return make_scoped_ptr(new LabelButtonAssetBorder(style));
+ if (!ui::MaterialDesignController::IsModeMaterial() ||
+ style != Button::STYLE_TEXTBUTTON) {
+ return make_scoped_ptr(new LabelButtonAssetBorder(style));
+ }
+
+ // The material design spec for Chrome OS includes no visual effects for
+ // button states, so a non-asset border with insets is used.
+ scoped_ptr<LabelButtonBorder> border(new views::LabelButtonBorder());
+ border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
+ Button::STYLE_TEXTBUTTON));
+ return border.Pass();
+}
+#elif !defined(OS_MACOSX)
+// static
+scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
+ Button::ButtonStyle style) {
+ scoped_ptr<LabelButtonAssetBorder> border(new LabelButtonAssetBorder(style));
+ // The material design spec does not include a visual effect for the
+ // STATE_HOVERED button state so we have to remove the default one added by
+ // LabelButtonAssetBorder.
+ if (ui::MaterialDesignController::IsModeMaterial())
+ border->SetPainter(false, Button::STATE_HOVERED, nullptr);
+ return border.Pass();
}
#endif
« no previous file with comments | « chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698