OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/gtk/gtk_theme_provider.h" | 5 #include "chrome/browser/gtk/gtk_theme_provider.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/gfx/gtk_util.h" | 9 #include "base/gfx/gtk_util.h" |
10 #include "chrome/browser/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "third_party/skia/include/core/SkCanvas.h" | 15 #include "third_party/skia/include/core/SkCanvas.h" |
| 16 #include "third_party/skia/include/core/SkColor.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // The size of the rendered toolbar image. | 20 // The size of the rendered toolbar image. |
20 const int kToolbarImageWidth = 64; | 21 const int kToolbarImageWidth = 64; |
21 const int kToolbarImageHeight = 128; | 22 const int kToolbarImageHeight = 128; |
22 | 23 |
23 } // namespace | 24 } // namespace |
24 | 25 |
25 GtkThemeProvider::GtkThemeProvider() | 26 GtkThemeProvider::GtkThemeProvider() |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 (color->green >> 8), | 146 (color->green >> 8), |
146 (color->blue >> 8)), hsl); | 147 (color->blue >> 8)), hsl); |
147 if (default_tint.s != -1) | 148 if (default_tint.s != -1) |
148 hsl.s = default_tint.s; | 149 hsl.s = default_tint.s; |
149 | 150 |
150 if (default_tint.l != -1) | 151 if (default_tint.l != -1) |
151 hsl.l = default_tint.l; | 152 hsl.l = default_tint.l; |
152 SetTint(id, hsl); | 153 SetTint(id, hsl); |
153 } | 154 } |
154 | 155 |
| 156 GtkThemeProperties::GtkThemeProperties(Profile* profile) |
| 157 : use_gtk_rendering(GtkThemeProvider::UseSystemThemeGraphics(profile)), |
| 158 provider(profile->GetThemeProvider()) { |
| 159 } |
| 160 |
| 161 GdkColor GtkThemeProperties::GetGdkColor(int id) { |
| 162 SkColor color = provider->GetColor(id); |
| 163 GdkColor gdkcolor = |
| 164 GDK_COLOR_RGB(SkColorGetR(color), SkColorGetG(color), |
| 165 SkColorGetB(color)); |
| 166 return gdkcolor; |
| 167 } |
OLD | NEW |