diff options
author | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 12:43:14 +0000 |
---|---|---|
committer | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 12:43:14 +0000 |
commit | 37d5293518a8657af4d79035f7ef2e8c3a8d6b9a (patch) | |
tree | 9897f36b9f09457d3a5fbb002abc4e081e79ae56 /chrome/browser/gtk | |
parent | 37c3dacaa38fddba1c53d9b3f3f0514933d3dd45 (diff) | |
download | chromium_src-37d5293518a8657af4d79035f7ef2e8c3a8d6b9a.zip chromium_src-37d5293518a8657af4d79035f7ef2e8c3a8d6b9a.tar.gz chromium_src-37d5293518a8657af4d79035f7ef2e8c3a8d6b9a.tar.bz2 |
Use PrefChangeRegistrar everywhere
BUG=54955
TEST=PrefChangeRegistrarTest.*
Review URL: http://codereview.chromium.org/3304015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.h | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/options/general_page_gtk.cc | 9 | ||||
-rw-r--r-- | chrome/browser/gtk/options/general_page_gtk.h | 3 |
4 files changed, 11 insertions, 8 deletions
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 7e5a2c2..5bcd8a3 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -258,7 +258,6 @@ GtkThemeProvider::GtkThemeProvider() } GtkThemeProvider::~GtkThemeProvider() { - profile()->GetPrefs()->RemovePrefObserver(prefs::kUsesSystemTheme, this); gtk_widget_destroy(fake_window_); gtk_widget_destroy(fake_frame_); fake_label_.Destroy(); @@ -273,7 +272,8 @@ GtkThemeProvider::~GtkThemeProvider() { } void GtkThemeProvider::Init(Profile* profile) { - profile->GetPrefs()->AddPrefObserver(prefs::kUsesSystemTheme, this); + registrar_.Init(profile->GetPrefs()); + registrar_.Add(prefs::kUsesSystemTheme, this); use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); BrowserThemeProvider::Init(profile); diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h index 33b1ec2..2ecef7a 100644 --- a/chrome/browser/gtk/gtk_theme_provider.h +++ b/chrome/browser/gtk/gtk_theme_provider.h @@ -12,6 +12,7 @@ #include "app/gtk_integers.h" #include "app/gtk_signal.h" #include "base/scoped_ptr.h" +#include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/gtk/owned_widget_gtk.h" #include "chrome/browser/themes/browser_theme_provider.h" #include "chrome/common/notification_observer.h" @@ -275,6 +276,8 @@ class GtkThemeProvider : public BrowserThemeProvider, PerDisplaySurfaceMap per_display_surfaces_; PerDisplaySurfaceMap per_display_unthemed_surfaces_; + PrefChangeRegistrar registrar_; + // This is a dummy widget that only exists so we have something to pass to // gtk_widget_render_icon(). static GtkWidget* icon_widget_; diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc index fb4db2b..734ee8c 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -95,8 +95,9 @@ GeneralPageGtk::GeneralPageGtk(Profile* profile) InitDefaultBrowserGroup(), false); #endif - profile->GetPrefs()->AddPrefObserver(prefs::kRestoreOnStartup, this); - profile->GetPrefs()->AddPrefObserver(prefs::kURLsToRestoreOnStartup, this); + registrar_.Init(profile->GetPrefs()); + registrar_.Add(prefs::kRestoreOnStartup, this); + registrar_.Add(prefs::kURLsToRestoreOnStartup, this); new_tab_page_is_home_page_.Init(prefs::kHomePageIsNewTabPage, profile->GetPrefs(), this); @@ -108,10 +109,6 @@ GeneralPageGtk::GeneralPageGtk(Profile* profile) } GeneralPageGtk::~GeneralPageGtk() { - profile()->GetPrefs()->RemovePrefObserver(prefs::kRestoreOnStartup, this); - profile()->GetPrefs()->RemovePrefObserver( - prefs::kURLsToRestoreOnStartup, this); - if (template_url_model_) template_url_model_->RemoveObserver(this); diff --git a/chrome/browser/gtk/options/general_page_gtk.h b/chrome/browser/gtk/options/general_page_gtk.h index 3a072ac..143f447 100644 --- a/chrome/browser/gtk/options/general_page_gtk.h +++ b/chrome/browser/gtk/options/general_page_gtk.h @@ -14,6 +14,7 @@ #include "chrome/browser/gtk/gtk_tree.h" #include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h" #include "chrome/browser/options_page_base.h" +#include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/search_engines/template_url_model_observer.h" #include "chrome/browser/shell_integration.h" @@ -160,6 +161,8 @@ class GeneralPageGtk : public OptionsPageBase, // Tracks managed preference warning banner state. ManagedPrefsBannerGtk managed_prefs_banner_; + PrefChangeRegistrar registrar_; + DISALLOW_COPY_AND_ASSIGN(GeneralPageGtk); }; |