| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/native_theme_gtk.h" | 5 #include "ui/gfx/native_theme_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> |
| 8 |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" |
| 11 #include "ui/gfx/skia_utils_gtk.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |
| 16 |
| 17 } // namespace |
| 8 | 18 |
| 9 namespace gfx { | 19 namespace gfx { |
| 10 | 20 |
| 11 // static | 21 // static |
| 12 const NativeTheme* NativeTheme::instance() { | 22 const NativeTheme* NativeTheme::instance() { |
| 13 return NativeThemeGtk::instance(); | 23 return NativeThemeGtk::instance(); |
| 14 } | 24 } |
| 15 | 25 |
| 16 // static | 26 // static |
| 17 const NativeThemeGtk* NativeThemeGtk::instance() { | 27 const NativeThemeGtk* NativeThemeGtk::instance() { |
| 18 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk, s_native_theme, ()); | 28 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk, s_native_theme, ()); |
| 19 return &s_native_theme; | 29 return &s_native_theme; |
| 20 } | 30 } |
| 21 | 31 |
| 32 SkColor NativeThemeGtk::GetSystemColor(ColorId color_id) const { |
| 33 switch (color_id) { |
| 34 case kColorId_DialogBackground: |
| 35 // TODO(benrg): This code used to call gtk_widget_get_style() on the |
| 36 // widget being styled. After refactoring, that widget is not available |
| 37 // and we have to call gtk_widget_get_default_style(). Does it matter? |
| 38 return gfx::GdkColorToSkColor( |
| 39 gtk_widget_get_default_style()->bg[GTK_STATE_NORMAL]); |
| 40 default: |
| 41 NOTREACHED() << "Invalid color_id: " << color_id; |
| 42 break; |
| 43 } |
| 44 return kInvalidColorIdColor; |
| 45 } |
| 46 |
| 22 NativeThemeGtk::NativeThemeGtk() { | 47 NativeThemeGtk::NativeThemeGtk() { |
| 23 } | 48 } |
| 24 | 49 |
| 25 NativeThemeGtk::~NativeThemeGtk() { | 50 NativeThemeGtk::~NativeThemeGtk() { |
| 26 } | 51 } |
| 27 | 52 |
| 28 } // namespace gfx | 53 } // namespace gfx |
| OLD | NEW |