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

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

Issue 1569113002: MacViews: Style BUTTON_STYLE buttons using the "modern" UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 4 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 | « ui/views/style/platform_style.h ('k') | ui/views/style/platform_style_linux.cc » ('j') | 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 6719c9ba46bf4ec8e2559743a560aa7fb8369b2c..84847674108255f47ad9738ef62e6cbff90f5725 100644
--- a/ui/views/style/platform_style.cc
+++ b/ui/views/style/platform_style.cc
@@ -7,6 +7,8 @@
#include "build/build_config.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/shadow_value.h"
+#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/label_button.h"
@@ -14,10 +16,27 @@
#include "ui/views/controls/focusable_border.h"
#include "ui/views/controls/scrollbar/native_scroll_bar.h"
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#define DESKTOP_LINUX
+#endif
+
namespace views {
+namespace {
+
+#if !defined(DESKTOP_LINUX) && !defined(OS_MACOSX)
+// Default text and shadow colors for STYLE_BUTTON.
+const SkColor kStyleButtonTextColor = SK_ColorBLACK;
+const SkColor kStyleButtonShadowColor = SK_ColorWHITE;
+#endif
+
+} // namespace
#if !defined(OS_MACOSX)
+const int PlatformStyle::kMinLabelButtonWidth = 70;
+const int PlatformStyle::kMinLabelButtonHeight = 33;
+const bool PlatformStyle::kDefaultLabelButtonHasBoldFont = true;
+
// static
gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled,
Combobox::Style style) {
@@ -53,9 +72,36 @@ scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
scoped_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
return make_scoped_ptr(new NativeScrollBar(is_horizontal));
}
+
+// static
+SkColor PlatformStyle::TextColorForButton(
+ const ButtonColorByState& color_by_state,
+ const LabelButton& button) {
+ return color_by_state[button.state()];
+}
+
+#endif // OS_MACOSX
+
+#if !defined(DESKTOP_LINUX) && !defined(OS_MACOSX)
+// static
+void PlatformStyle::ApplyLabelButtonTextStyle(
+ Label* label,
+ ButtonColorByState* color_by_state) {
+ ButtonColorByState& colors = *color_by_state;
+ colors[Button::STATE_NORMAL] = kStyleButtonTextColor;
+ colors[Button::STATE_HOVERED] = kStyleButtonTextColor;
+ colors[Button::STATE_PRESSED] = kStyleButtonTextColor;
+
+ const ui::NativeTheme* theme = label->GetNativeTheme();
+ label->SetBackgroundColor(
+ theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonBackgroundColor));
+ label->SetAutoColorReadabilityEnabled(false);
+ label->SetShadows(gfx::ShadowValues(
+ 1, gfx::ShadowValue(gfx::Vector2d(0, 1), 0, kStyleButtonShadowColor)));
+}
#endif
-#if !defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if !defined(DESKTOP_LINUX)
// static
scoped_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder(
LabelButton* button) {
« no previous file with comments | « ui/views/style/platform_style.h ('k') | ui/views/style/platform_style_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698