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

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

Issue 11421191: Notify the ThemeService on extension install and not extension load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // We have to call this because FreePlatformCached() in ~ThemeService 287 // We have to call this because FreePlatformCached() in ~ThemeService
288 // doesn't call the right virutal FreePlatformCaches. 288 // doesn't call the right virutal FreePlatformCaches.
289 FreePlatformCaches(); 289 FreePlatformCaches();
290 } 290 }
291 291
292 void GtkThemeService::Init(Profile* profile) { 292 void GtkThemeService::Init(Profile* profile) {
293 registrar_.Init(profile->GetPrefs()); 293 registrar_.Init(profile->GetPrefs());
294 registrar_.Add(prefs::kUsesSystemTheme, 294 registrar_.Add(prefs::kUsesSystemTheme,
295 base::Bind(&GtkThemeService::OnUsesSystemThemeChanged, 295 base::Bind(&GtkThemeService::OnUsesSystemThemeChanged,
296 base::Unretained(this))); 296 base::Unretained(this)));
297 use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
298 ThemeService::Init(profile); 297 ThemeService::Init(profile);
299 } 298 }
300 299
301 gfx::ImageSkia* GtkThemeService::GetImageSkiaNamed(int id) const { 300 gfx::ImageSkia* GtkThemeService::GetImageSkiaNamed(int id) const {
302 // TODO(pkotwicz): Remove this const cast. The gfx::Image interface returns 301 // TODO(pkotwicz): Remove this const cast. The gfx::Image interface returns
303 // its images const. GetImageSkiaNamed() also should but has many callsites. 302 // its images const. GetImageSkiaNamed() also should but has many callsites.
304 return const_cast<gfx::ImageSkia*>(GetImageNamed(id).ToImageSkia()); 303 return const_cast<gfx::ImageSkia*>(GetImageNamed(id).ToImageSkia());
305 } 304 }
306 305
307 gfx::Image GtkThemeService::GetImageNamed(int id) const { 306 gfx::Image GtkThemeService::GetImageNamed(int id) const {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 612 }
614 613
615 void GtkThemeService::ClearAllThemeData() { 614 void GtkThemeService::ClearAllThemeData() {
616 colors_.clear(); 615 colors_.clear();
617 tints_.clear(); 616 tints_.clear();
618 617
619 ThemeService::ClearAllThemeData(); 618 ThemeService::ClearAllThemeData();
620 } 619 }
621 620
622 void GtkThemeService::LoadThemePrefs() { 621 void GtkThemeService::LoadThemePrefs() {
622 if (ThemeService::UsingDefaultTheme()) {
623 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
624 } else {
625 // Do this here since ThemeServiceFactory::SetThemeForProfile()
626 // doesn't know to set kUsesSystemTheme to false.
627 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false);
628 use_gtk_ = false;
629 }
623 if (use_gtk_) { 630 if (use_gtk_) {
624 LoadGtkValues(); 631 LoadGtkValues();
625 } else { 632 } else {
626 LoadDefaultValues(); 633 LoadDefaultValues();
627 ThemeService::LoadThemePrefs(); 634 ThemeService::LoadThemePrefs();
628 } 635 }
629 636
630 RebuildMenuIconSets(); 637 RebuildMenuIconSets();
631 } 638 }
632 639
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 cairo_stroke(cr); 1151 cairo_stroke(cr);
1145 cairo_destroy(cr); 1152 cairo_destroy(cr);
1146 cairo_pattern_destroy(pattern); 1153 cairo_pattern_destroy(pattern);
1147 1154
1148 return TRUE; 1155 return TRUE;
1149 } 1156 }
1150 1157
1151 void GtkThemeService::OnUsesSystemThemeChanged() { 1158 void GtkThemeService::OnUsesSystemThemeChanged() {
1152 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 1159 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
1153 } 1160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698