OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/gtk_theme_service.h" | 5 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
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.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.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/extensions/extension.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
30 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
32 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
33 #include "grit/theme_resources_standard.h" | 34 #include "grit/theme_resources_standard.h" |
34 #include "grit/ui_resources.h" | 35 #include "grit/ui_resources.h" |
35 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
36 #include "third_party/skia/include/core/SkCanvas.h" | 37 #include "third_party/skia/include/core/SkCanvas.h" |
37 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 340 |
340 return ThemeService::HasCustomImage(id); | 341 return ThemeService::HasCustomImage(id); |
341 } | 342 } |
342 | 343 |
343 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { | 344 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { |
344 observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 345 observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
345 content::Source<ThemeService>(this), | 346 content::Source<ThemeService>(this), |
346 content::NotificationService::NoDetails()); | 347 content::NotificationService::NoDetails()); |
347 } | 348 } |
348 | 349 |
349 void GtkThemeService::SetTheme(const Extension* extension) { | 350 void GtkThemeService::SetTheme(const extensions::Extension* extension) { |
350 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 351 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
351 LoadDefaultValues(); | 352 LoadDefaultValues(); |
352 ThemeService::SetTheme(extension); | 353 ThemeService::SetTheme(extension); |
353 } | 354 } |
354 | 355 |
355 void GtkThemeService::UseDefaultTheme() { | 356 void GtkThemeService::UseDefaultTheme() { |
356 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 357 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
357 LoadDefaultValues(); | 358 LoadDefaultValues(); |
358 ThemeService::UseDefaultTheme(); | 359 ThemeService::UseDefaultTheme(); |
359 } | 360 } |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 cairo_new_path(cr); | 1151 cairo_new_path(cr); |
1151 cairo_set_line_width(cr, 1.0); | 1152 cairo_set_line_width(cr, 1.0); |
1152 cairo_move_to(cr, start_x, allocation.y); | 1153 cairo_move_to(cr, start_x, allocation.y); |
1153 cairo_line_to(cr, start_x, allocation.y + allocation.height); | 1154 cairo_line_to(cr, start_x, allocation.y + allocation.height); |
1154 cairo_stroke(cr); | 1155 cairo_stroke(cr); |
1155 cairo_destroy(cr); | 1156 cairo_destroy(cr); |
1156 cairo_pattern_destroy(pattern); | 1157 cairo_pattern_destroy(pattern); |
1157 | 1158 |
1158 return TRUE; | 1159 return TRUE; |
1159 } | 1160 } |
OLD | NEW |