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

Unified Diff: ui/gfx/native_theme_gtk.cc

Issue 8597015: Add a new GetSystemColor method to native theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 9 years, 1 month 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/gfx/native_theme_gtk.cc
diff --git a/ui/gfx/native_theme_gtk.cc b/ui/gfx/native_theme_gtk.cc
index ded99849de5a17b469275bbbd38ab6b7ddd27e36..df430d71654e489a9c121a67f4f8e63c340b2587 100644
--- a/ui/gfx/native_theme_gtk.cc
+++ b/ui/gfx/native_theme_gtk.cc
@@ -4,7 +4,17 @@
#include "ui/gfx/native_theme_gtk.h"
+#include <gtk/gtk.h>
+
#include "base/basictypes.h"
+#include "base/logging.h"
+#include "ui/gfx/skia_utils_gtk.h"
+
+namespace {
+
+const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
+
+} // namespace
namespace gfx {
@@ -19,6 +29,21 @@ const NativeThemeGtk* NativeThemeGtk::instance() {
return &s_native_theme;
}
+SkColor NativeThemeGtk::GetSystemColor(ColorId color_id) const {
+ switch (color_id) {
+ case kDialogBackgroundColorId:
+ // TODO(benrg): This code used to call gtk_widget_get_style() on the
+ // widget being styled. After refactoring, that widget is not available
+ // and we have to call gtk_widget_get_default_style(). Does it matter?
+ return gfx::GdkColorToSkColor(
+ gtk_widget_get_default_style()->bg[GTK_STATE_NORMAL]);
+ default:
+ NOTREACHED() << "Invalid color_id: " << color_id;
+ break;
+ }
+ return kInvalidColorIdColor;
+}
+
NativeThemeGtk::NativeThemeGtk() {
}

Powered by Google App Engine
This is Rietveld 408576698