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/mime_util_xdg.h" | 14 #include "base/nix/mime_util_xdg.h" |
15 #include "base/nix/xdg_util.h" | 15 #include "base/nix/xdg_util.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/themes/custom_theme_supplier.h" | |
20 #include "chrome/browser/themes/theme_properties.h" | 21 #include "chrome/browser/themes/theme_properties.h" |
21 #include "chrome/browser/themes/theme_service_factory.h" | 22 #include "chrome/browser/themes/theme_service_factory.h" |
22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_iterator.h" | 24 #include "chrome/browser/ui/browser_iterator.h" |
24 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" | 26 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" |
26 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 27 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
27 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 28 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
28 #include "chrome/browser/ui/gtk/gtk_util.h" | 29 #include "chrome/browser/ui/gtk/gtk_util.h" |
29 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" | 30 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 content::Source<ThemeService>(this), | 345 content::Source<ThemeService>(this), |
345 content::NotificationService::NoDetails()); | 346 content::NotificationService::NoDetails()); |
346 } | 347 } |
347 | 348 |
348 void GtkThemeService::SetTheme(const extensions::Extension* extension) { | 349 void GtkThemeService::SetTheme(const extensions::Extension* extension) { |
349 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 350 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
350 LoadDefaultValues(); | 351 LoadDefaultValues(); |
351 ThemeService::SetTheme(extension); | 352 ThemeService::SetTheme(extension); |
352 } | 353 } |
353 | 354 |
355 void GtkThemeService::SetCustomDefaultTheme( | |
356 scoped_refptr<CustomThemeSupplier> theme_supplier) { | |
357 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | |
pkotwicz
2013/08/09 14:23:02
For the sake of consistency, do you need to also s
Adrian Kuegel
2013/08/09 15:43:01
Right. I also think it should be in the SetTheme()
| |
358 LoadDefaultValues(); | |
359 ThemeService::SetCustomDefaultTheme(theme_supplier); | |
360 } | |
361 | |
354 void GtkThemeService::UseDefaultTheme() { | 362 void GtkThemeService::UseDefaultTheme() { |
355 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 363 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
356 use_gtk_ = false; | 364 use_gtk_ = false; |
357 LoadDefaultValues(); | 365 LoadDefaultValues(); |
358 ThemeService::UseDefaultTheme(); | 366 ThemeService::UseDefaultTheme(); |
359 } | 367 } |
360 | 368 |
361 void GtkThemeService::SetNativeTheme() { | 369 void GtkThemeService::SetNativeTheme() { |
362 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); | 370 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); |
363 use_gtk_ = true; | 371 use_gtk_ = true; |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1171 cairo_stroke(cr); | 1179 cairo_stroke(cr); |
1172 cairo_destroy(cr); | 1180 cairo_destroy(cr); |
1173 cairo_pattern_destroy(pattern); | 1181 cairo_pattern_destroy(pattern); |
1174 | 1182 |
1175 return TRUE; | 1183 return TRUE; |
1176 } | 1184 } |
1177 | 1185 |
1178 void GtkThemeService::OnUsesSystemThemeChanged() { | 1186 void GtkThemeService::OnUsesSystemThemeChanged() { |
1179 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); | 1187 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); |
1180 } | 1188 } |
OLD | NEW |