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

Unified Diff: chrome/browser/ui/gtk/gtk_theme_service.cc

Issue 19471005: Add custom default theme support and create a managed user default theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't call NotifyThemeChanged if not ready. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/gtk_theme_service.cc
diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc
index 53378609ccdd332607c100d01bc87f7cac4f0fdf..b7f820186cfe56a413384a6fce2f2478d5e4616e 100644
--- a/chrome/browser/ui/gtk/gtk_theme_service.cc
+++ b/chrome/browser/ui/gtk/gtk_theme_service.cc
@@ -298,7 +298,6 @@ void GtkThemeService::Init(Profile* profile) {
registrar_.Add(prefs::kUsesSystemTheme,
base::Bind(&GtkThemeService::OnUsesSystemThemeChanged,
base::Unretained(this)));
- use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
ThemeService::Init(profile);
}
@@ -309,14 +308,6 @@ gfx::ImageSkia* GtkThemeService::GetImageSkiaNamed(int id) const {
}
gfx::Image GtkThemeService::GetImageNamed(int id) const {
- // TODO(akuegel): Remove this once we have the default managed user theme.
- if (ManagedUserService::ProfileIsManaged(profile())) {
- if (id == IDR_THEME_FRAME)
- id = IDR_MANAGED_USER_THEME_FRAME;
- else if (id == IDR_THEME_FRAME_INACTIVE)
- id = IDR_MANAGED_USER_THEME_FRAME_INACTIVE;
- }
-
// Try to get our cached version:
ImageCache::const_iterator it = gtk_images_.find(id);
if (it != gtk_images_.end())
@@ -333,14 +324,6 @@ gfx::Image GtkThemeService::GetImageNamed(int id) const {
}
SkColor GtkThemeService::GetColor(int id) const {
- // TODO(akuegel): Remove this once we have the default managed user theme.
- if (ManagedUserService::ProfileIsManaged(profile())) {
- if (id == ThemeProperties::COLOR_FRAME)
- id = ThemeProperties::COLOR_FRAME_MANAGED_USER;
- else if (id == ThemeProperties::COLOR_FRAME_INACTIVE)
- id = ThemeProperties::COLOR_FRAME_MANAGED_USER_INACTIVE;
- }
-
if (use_gtk_) {
ColorMap::const_iterator it = colors_.find(id);
if (it != colors_.end())
@@ -371,12 +354,14 @@ void GtkThemeService::SetTheme(const extensions::Extension* extension) {
void GtkThemeService::UseDefaultTheme() {
profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false);
+ use_gtk_ = false;
LoadDefaultValues();
ThemeService::UseDefaultTheme();
}
void GtkThemeService::SetNativeTheme() {
profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true);
+ use_gtk_ = true;
ClearAllThemeData();
LoadGtkValues();
NotifyThemeChanged();
@@ -386,6 +371,10 @@ bool GtkThemeService::UsingDefaultTheme() const {
return !use_gtk_ && ThemeService::UsingDefaultTheme();
}
+bool GtkThemeService::ShouldInitWithNativeTheme() const {
+ return profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
+}
+
bool GtkThemeService::UsingNativeTheme() const {
return use_gtk_;
}
@@ -650,13 +639,8 @@ void GtkThemeService::ClearAllThemeData() {
}
void GtkThemeService::LoadThemePrefs() {
- if (use_gtk_) {
- LoadGtkValues();
- set_ready();
- } else {
- LoadDefaultValues();
- ThemeService::LoadThemePrefs();
- }
+ // This takes care of calling SetNativeTheme() if necessary.
+ ThemeService::LoadThemePrefs();
SetXDGIconTheme();
RebuildMenuIconSets();
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698