| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gfx/color_utils.h" | 9 #include "app/gfx/color_utils.h" |
| 10 #include "app/gfx/gtk_util.h" | 10 #include "app/gfx/gtk_util.h" |
| 11 #include "app/gfx/skbitmap_operations.h" | 11 #include "app/gfx/skbitmap_operations.h" |
| 12 #include "app/gfx/skia_utils_gtk.h" |
| 12 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
| 13 #include "base/stl_util-inl.h" | 14 #include "base/stl_util-inl.h" |
| 14 #include "chrome/browser/metrics/user_metrics.h" | 15 #include "chrome/browser/metrics/user_metrics.h" |
| 15 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/gtk/cairo_cached_surface.h" | 17 #include "chrome/browser/gtk/cairo_cached_surface.h" |
| 17 #include "chrome/browser/gtk/gtk_chrome_button.h" | 18 #include "chrome/browser/gtk/gtk_chrome_button.h" |
| 18 #include "chrome/browser/gtk/meta_frames.h" | 19 #include "chrome/browser/gtk/meta_frames.h" |
| 19 #include "chrome/browser/pref_service.h" | 20 #include "chrome/browser/pref_service.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/common/notification_details.h" | 22 #include "chrome/common/notification_details.h" |
| 22 #include "chrome/common/notification_service.h" | 23 #include "chrome/common/notification_service.h" |
| 23 #include "chrome/common/notification_source.h" | 24 #include "chrome/common/notification_source.h" |
| 24 #include "chrome/common/notification_type.h" | 25 #include "chrome/common/notification_type.h" |
| 25 #include "skia/ext/skia_utils_gtk.h" | |
| 26 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| 27 #include "third_party/skia/include/core/SkCanvas.h" | 27 #include "third_party/skia/include/core/SkCanvas.h" |
| 28 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
| 29 #include "grit/app_resources.h" | 29 #include "grit/app_resources.h" |
| 30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // The size of the rendered toolbar image. | 34 // The size of the rendered toolbar image. |
| 35 const int kToolbarImageWidth = 64; | 35 const int kToolbarImageWidth = 64; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 g_signal_connect(button, "destroy", G_CALLBACK(OnDestroyChromeButton), | 213 g_signal_connect(button, "destroy", G_CALLBACK(OnDestroyChromeButton), |
| 214 this); | 214 this); |
| 215 return button; | 215 return button; |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool GtkThemeProvider::UseGtkTheme() const { | 218 bool GtkThemeProvider::UseGtkTheme() const { |
| 219 return use_gtk_; | 219 return use_gtk_; |
| 220 } | 220 } |
| 221 | 221 |
| 222 GdkColor GtkThemeProvider::GetGdkColor(int id) const { | 222 GdkColor GtkThemeProvider::GetGdkColor(int id) const { |
| 223 return skia::SkColorToGdkColor(GetColor(id)); | 223 return gfx::SkColorToGdkColor(GetColor(id)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 GdkColor GtkThemeProvider::GetBorderColor() const { | 226 GdkColor GtkThemeProvider::GetBorderColor() const { |
| 227 GtkStyle* style = gtk_rc_get_style(fake_window_); | 227 GtkStyle* style = gtk_rc_get_style(fake_window_); |
| 228 | 228 |
| 229 GdkColor text; | 229 GdkColor text; |
| 230 GdkColor bg; | 230 GdkColor bg; |
| 231 if (use_gtk_) { | 231 if (use_gtk_) { |
| 232 text = style->text[GTK_STATE_NORMAL]; | 232 text = style->text[GTK_STATE_NORMAL]; |
| 233 bg = style->bg[GTK_STATE_NORMAL]; | 233 bg = style->bg[GTK_STATE_NORMAL]; |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 729 } |
| 730 | 730 |
| 731 void GtkThemeProvider::OnDestroyChromeButton(GtkWidget* button, | 731 void GtkThemeProvider::OnDestroyChromeButton(GtkWidget* button, |
| 732 GtkThemeProvider* provider) { | 732 GtkThemeProvider* provider) { |
| 733 std::vector<GtkWidget*>::iterator it = | 733 std::vector<GtkWidget*>::iterator it = |
| 734 find(provider->chrome_buttons_.begin(), provider->chrome_buttons_.end(), | 734 find(provider->chrome_buttons_.begin(), provider->chrome_buttons_.end(), |
| 735 button); | 735 button); |
| 736 if (it != provider->chrome_buttons_.end()) | 736 if (it != provider->chrome_buttons_.end()) |
| 737 provider->chrome_buttons_.erase(it); | 737 provider->chrome_buttons_.erase(it); |
| 738 } | 738 } |
| OLD | NEW |