| OLD | NEW |
| 1 | 1 |
| 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 6 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/environment.h" | 13 #include "base/environment.h" |
| 14 #include "base/nix/xdg_util.h" | 14 #include "base/nix/xdg_util.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/themes/theme_service_factory.h" | 18 #include "chrome/browser/themes/theme_service_factory.h" |
| 19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" | 21 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" |
| 22 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" | 22 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" |
| 23 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 23 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
| 24 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 24 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 25 #include "chrome/browser/ui/gtk/gtk_util.h" | 25 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 26 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" | 26 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "content/browser/user_metrics.h" | 29 #include "content/browser/user_metrics.h" |
| 30 #include "content/common/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/browser/notification_details.h" | 31 #include "content/public/browser/notification_details.h" |
| 32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
| 33 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
| 34 #include "grit/theme_resources_standard.h" | 34 #include "grit/theme_resources_standard.h" |
| 35 #include "grit/ui_resources.h" | 35 #include "grit/ui_resources.h" |
| 36 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
| 37 #include "third_party/skia/include/core/SkCanvas.h" | 37 #include "third_party/skia/include/core/SkCanvas.h" |
| 38 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
| 39 #include "third_party/skia/include/core/SkShader.h" | 39 #include "third_party/skia/include/core/SkShader.h" |
| 40 #include "ui/base/gtk/gtk_hig_constants.h" | 40 #include "ui/base/gtk/gtk_hig_constants.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 bool GtkThemeService::HasCustomImage(int id) const { | 331 bool GtkThemeService::HasCustomImage(int id) const { |
| 332 if (use_gtk_) | 332 if (use_gtk_) |
| 333 return IsOverridableImage(id); | 333 return IsOverridableImage(id); |
| 334 | 334 |
| 335 return ThemeService::HasCustomImage(id); | 335 return ThemeService::HasCustomImage(id); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { | 338 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { |
| 339 observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 339 observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 340 content::Source<ThemeService>(this), | 340 content::Source<ThemeService>(this), |
| 341 NotificationService::NoDetails()); | 341 content::NotificationService::NoDetails()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void GtkThemeService::SetTheme(const Extension* extension) { | 344 void GtkThemeService::SetTheme(const Extension* extension) { |
| 345 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 345 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
| 346 LoadDefaultValues(); | 346 LoadDefaultValues(); |
| 347 ThemeService::SetTheme(extension); | 347 ThemeService::SetTheme(extension); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void GtkThemeService::UseDefaultTheme() { | 350 void GtkThemeService::UseDefaultTheme() { |
| 351 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 351 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 cairo_set_line_width(cr, 1.0); | 1198 cairo_set_line_width(cr, 1.0); |
| 1199 cairo_move_to(cr, start_x, widget->allocation.y); | 1199 cairo_move_to(cr, start_x, widget->allocation.y); |
| 1200 cairo_line_to(cr, start_x, | 1200 cairo_line_to(cr, start_x, |
| 1201 widget->allocation.y + widget->allocation.height); | 1201 widget->allocation.y + widget->allocation.height); |
| 1202 cairo_stroke(cr); | 1202 cairo_stroke(cr); |
| 1203 cairo_destroy(cr); | 1203 cairo_destroy(cr); |
| 1204 cairo_pattern_destroy(pattern); | 1204 cairo_pattern_destroy(pattern); |
| 1205 | 1205 |
| 1206 return TRUE; | 1206 return TRUE; |
| 1207 } | 1207 } |
| OLD | NEW |