| 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_iterator.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/extensions/extension.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 gtk_chrome_link_button_set_use_gtk_theme( | 646 gtk_chrome_link_button_set_use_gtk_theme( |
| 647 GTK_CHROME_LINK_BUTTON(*it), use_gtk_); | 647 GTK_CHROME_LINK_BUTTON(*it), use_gtk_); |
| 648 } | 648 } |
| 649 | 649 |
| 650 for (std::map<GtkWidget*, GdkColor>::iterator it = labels_.begin(); | 650 for (std::map<GtkWidget*, GdkColor>::iterator it = labels_.begin(); |
| 651 it != labels_.end(); ++it) { | 651 it != labels_.end(); ++it) { |
| 652 const GdkColor* color = use_gtk_ ? NULL : &it->second; | 652 const GdkColor* color = use_gtk_ ? NULL : &it->second; |
| 653 gtk_util::SetLabelColor(it->first, color); | 653 gtk_util::SetLabelColor(it->first, color); |
| 654 } | 654 } |
| 655 | 655 |
| 656 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); | 656 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 657 browser_iterator != BrowserList::end(); browser_iterator++) { | 657 Browser* browser = *it; |
| 658 Browser* browser = (*browser_iterator); | |
| 659 if (!browser->window()) | 658 if (!browser->window()) |
| 660 continue; | 659 continue; |
| 661 GtkWindow* window = browser->window()->GetNativeWindow(); | 660 GtkWindow* window = browser->window()->GetNativeWindow(); |
| 662 gtk_util::SetDefaultWindowIcon(window); | 661 gtk_util::SetDefaultWindowIcon(window); |
| 663 gtk_util::SetWindowIcon(window, browser->profile()); | 662 gtk_util::SetWindowIcon(window, browser->profile()); |
| 664 } | 663 } |
| 665 } | 664 } |
| 666 | 665 |
| 667 void GtkThemeService::FreePlatformCaches() { | 666 void GtkThemeService::FreePlatformCaches() { |
| 668 ThemeService::FreePlatformCaches(); | 667 ThemeService::FreePlatformCaches(); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 cairo_stroke(cr); | 1143 cairo_stroke(cr); |
| 1145 cairo_destroy(cr); | 1144 cairo_destroy(cr); |
| 1146 cairo_pattern_destroy(pattern); | 1145 cairo_pattern_destroy(pattern); |
| 1147 | 1146 |
| 1148 return TRUE; | 1147 return TRUE; |
| 1149 } | 1148 } |
| 1150 | 1149 |
| 1151 void GtkThemeService::OnUsesSystemThemeChanged() { | 1150 void GtkThemeService::OnUsesSystemThemeChanged() { |
| 1152 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); | 1151 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); |
| 1153 } | 1152 } |
| OLD | NEW |