Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/browser/ui/gtk/gtk_theme_service.cc

Issue 22578004: Check if theme is ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 case base::nix::DESKTOP_ENVIRONMENT_KDE3: 623 case base::nix::DESKTOP_ENVIRONMENT_KDE3:
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() {
634 colors_.clear();
635 tints_.clear();
636
637 ThemeService::ClearAllThemeData();
638 }
639
640 void GtkThemeService::LoadThemePrefs() { 633 void GtkThemeService::LoadThemePrefs() {
641 // Initialize the values sent to webkit with the default values. 634 // Initialize the values sent to webkit with the default values.
642 // ThemeService::LoadThemePrefs() will replace them with values for the native 635 // ThemeService::LoadThemePrefs() will replace them with values for the native
643 // gtk theme if necessary. 636 // gtk theme if necessary.
644 LoadDefaultValues(); 637 LoadDefaultValues();
645 638
646 // This takes care of calling SetNativeTheme() if necessary. 639 // This takes care of calling SetNativeTheme() if necessary.
647 ThemeService::LoadThemePrefs(); 640 ThemeService::LoadThemePrefs();
648 641
649 SetXDGIconTheme(); 642 SetXDGIconTheme();
650 RebuildMenuIconSets(); 643 RebuildMenuIconSets();
651 } 644 }
652 645
653 void GtkThemeService::NotifyThemeChanged() { 646 void GtkThemeService::NotifyThemeChanged() {
647 if (!ready_)
648 return;
649
654 ThemeService::NotifyThemeChanged(); 650 ThemeService::NotifyThemeChanged();
655 651
656 // Notify all GtkChromeButtons of their new rendering mode: 652 // Notify all GtkChromeButtons of their new rendering mode:
657 for (std::vector<GtkWidget*>::iterator it = chrome_buttons_.begin(); 653 for (std::vector<GtkWidget*>::iterator it = chrome_buttons_.begin();
658 it != chrome_buttons_.end(); ++it) { 654 it != chrome_buttons_.end(); ++it) {
659 gtk_chrome_button_set_use_gtk_rendering( 655 gtk_chrome_button_set_use_gtk_rendering(
660 GTK_CHROME_BUTTON(*it), use_gtk_); 656 GTK_CHROME_BUTTON(*it), use_gtk_);
661 } 657 }
662 658
663 for (std::vector<GtkWidget*>::iterator it = link_buttons_.begin(); 659 for (std::vector<GtkWidget*>::iterator it = link_buttons_.begin();
(...skipping 12 matching lines...) Expand all
676 Browser* browser = *it; 672 Browser* browser = *it;
677 if (!browser->window()) 673 if (!browser->window())
678 continue; 674 continue;
679 GtkWindow* window = browser->window()->GetNativeWindow(); 675 GtkWindow* window = browser->window()->GetNativeWindow();
680 gtk_util::SetDefaultWindowIcon(window); 676 gtk_util::SetDefaultWindowIcon(window);
681 gtk_util::SetWindowIcon(window, browser->profile()); 677 gtk_util::SetWindowIcon(window, browser->profile());
682 } 678 }
683 } 679 }
684 680
685 void GtkThemeService::FreePlatformCaches() { 681 void GtkThemeService::FreePlatformCaches() {
682 colors_.clear();
683 tints_.clear();
686 ThemeService::FreePlatformCaches(); 684 ThemeService::FreePlatformCaches();
687 STLDeleteValues(&gtk_images_); 685 STLDeleteValues(&gtk_images_);
688 } 686 }
689 687
690 void GtkThemeService::OnStyleSet(GtkWidget* widget, 688 void GtkThemeService::OnStyleSet(GtkWidget* widget,
691 GtkStyle* previous_style) { 689 GtkStyle* previous_style) {
692 default_folder_icon_.Get() = gfx::Image(); 690 default_folder_icon_.Get() = gfx::Image();
693 default_bookmark_icon_.Get() = gfx::Image(); 691 default_bookmark_icon_.Get() = gfx::Image();
694 692
695 if (profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) { 693 if (profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) {
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 cairo_stroke(cr); 1171 cairo_stroke(cr);
1174 cairo_destroy(cr); 1172 cairo_destroy(cr);
1175 cairo_pattern_destroy(pattern); 1173 cairo_pattern_destroy(pattern);
1176 1174
1177 return TRUE; 1175 return TRUE;
1178 } 1176 }
1179 1177
1180 void GtkThemeService::OnUsesSystemThemeChanged() { 1178 void GtkThemeService::OnUsesSystemThemeChanged() {
1181 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 1179 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
1182 } 1180 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698