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> |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 case base::nix::DESKTOP_ENVIRONMENT_KDE4: | 624 case base::nix::DESKTOP_ENVIRONMENT_KDE4: |
625 case base::nix::DESKTOP_ENVIRONMENT_OTHER: | 625 case base::nix::DESKTOP_ENVIRONMENT_OTHER: |
626 return false; | 626 return false; |
627 } | 627 } |
628 // Unless GetDesktopEnvironment() badly misbehaves, this should never happen. | 628 // Unless GetDesktopEnvironment() badly misbehaves, this should never happen. |
629 NOTREACHED(); | 629 NOTREACHED(); |
630 return false; | 630 return false; |
631 } | 631 } |
632 | 632 |
633 void GtkThemeService::ClearAllThemeData() { | 633 void GtkThemeService::ClearAllThemeData() { |
634 colors_.clear(); | 634 colors_.clear(); |
pkotwicz
2013/08/07 16:46:10
Can this code be moved to GtkThemeService::FreePla
pkotwicz
2013/08/07 16:46:10
Can we move this code to FreePlatformCaches() ?
Adrian Kuegel
2013/08/07 18:25:33
Done.
| |
635 tints_.clear(); | 635 tints_.clear(); |
636 | 636 |
637 ThemeService::ClearAllThemeData(); | 637 ThemeService::ClearAllThemeData(); |
638 } | 638 } |
639 | 639 |
640 void GtkThemeService::LoadThemePrefs() { | 640 void GtkThemeService::LoadThemePrefs() { |
641 // Initialize the values sent to webkit with the default values. | 641 // Initialize the values sent to webkit with the default values. |
642 // ThemeService::LoadThemePrefs() will replace them with values for the native | 642 // ThemeService::LoadThemePrefs() will replace them with values for the native |
643 // gtk theme if necessary. | 643 // gtk theme if necessary. |
644 LoadDefaultValues(); | 644 LoadDefaultValues(); |
645 | 645 |
646 // This takes care of calling SetNativeTheme() if necessary. | 646 // This takes care of calling SetNativeTheme() if necessary. |
647 ThemeService::LoadThemePrefs(); | 647 ThemeService::LoadThemePrefs(); |
648 | 648 |
649 SetXDGIconTheme(); | 649 SetXDGIconTheme(); |
650 RebuildMenuIconSets(); | 650 RebuildMenuIconSets(); |
651 } | 651 } |
652 | 652 |
653 void GtkThemeService::NotifyThemeChanged() { | 653 void GtkThemeService::NotifyThemeChanged() { |
654 if (!ready_) | |
655 return; | |
656 | |
654 ThemeService::NotifyThemeChanged(); | 657 ThemeService::NotifyThemeChanged(); |
655 | 658 |
656 // Notify all GtkChromeButtons of their new rendering mode: | 659 // Notify all GtkChromeButtons of their new rendering mode: |
657 for (std::vector<GtkWidget*>::iterator it = chrome_buttons_.begin(); | 660 for (std::vector<GtkWidget*>::iterator it = chrome_buttons_.begin(); |
658 it != chrome_buttons_.end(); ++it) { | 661 it != chrome_buttons_.end(); ++it) { |
659 gtk_chrome_button_set_use_gtk_rendering( | 662 gtk_chrome_button_set_use_gtk_rendering( |
660 GTK_CHROME_BUTTON(*it), use_gtk_); | 663 GTK_CHROME_BUTTON(*it), use_gtk_); |
661 } | 664 } |
662 | 665 |
663 for (std::vector<GtkWidget*>::iterator it = link_buttons_.begin(); | 666 for (std::vector<GtkWidget*>::iterator it = link_buttons_.begin(); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1173 cairo_stroke(cr); | 1176 cairo_stroke(cr); |
1174 cairo_destroy(cr); | 1177 cairo_destroy(cr); |
1175 cairo_pattern_destroy(pattern); | 1178 cairo_pattern_destroy(pattern); |
1176 | 1179 |
1177 return TRUE; | 1180 return TRUE; |
1178 } | 1181 } |
1179 | 1182 |
1180 void GtkThemeService::OnUsesSystemThemeChanged() { | 1183 void GtkThemeService::OnUsesSystemThemeChanged() { |
1181 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); | 1184 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); |
1182 } | 1185 } |
OLD | NEW |