summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 13:57:46 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 13:57:46 +0000
commit0b3fa50cd4eb5b1ba6a8820bcc352ef6876ba9e9 (patch)
tree6e8aa36744e68b0b9186fcc061143a167bc18d56 /chrome
parent0488213c87b059d347d77cac33ad4e26c8080c99 (diff)
downloadchromium_src-0b3fa50cd4eb5b1ba6a8820bcc352ef6876ba9e9.zip
chromium_src-0b3fa50cd4eb5b1ba6a8820bcc352ef6876ba9e9.tar.gz
chromium_src-0b3fa50cd4eb5b1ba6a8820bcc352ef6876ba9e9.tar.bz2
Remove PrefObserver usage, batch 9.
TBR=abodenha@chromium.org,erikkay@chromium.org,erikwright@chromium.org,erg@chromium.org,ben@chromium.org,xiyuan@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/11414083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/net/http_server_properties_manager.cc18
-rw-r--r--chrome/browser/net/http_server_properties_manager.h8
-rw-r--r--chrome/browser/net/net_pref_observer.cc11
-rw-r--r--chrome/browser/net/net_pref_observer.h7
-rw-r--r--chrome/browser/net/ssl_config_service_manager_pref.cc45
-rw-r--r--chrome/browser/policy/cloud_policy_refresh_scheduler.cc13
-rw-r--r--chrome/browser/policy/cloud_policy_refresh_scheduler.h6
-rw-r--r--chrome/browser/policy/cloud_policy_subsystem.cc10
-rw-r--r--chrome/browser/policy/cloud_policy_subsystem.h8
-rw-r--r--chrome/browser/policy/url_blacklist_manager.cc15
-rw-r--r--chrome/browser/policy/url_blacklist_manager.h6
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc12
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_proxy_service.h8
-rw-r--r--chrome/browser/printing/print_view_manager.cc13
-rw-r--r--chrome/browser/printing/print_view_manager.h6
-rw-r--r--chrome/browser/profiles/gaia_info_update_service.cc10
-rw-r--r--chrome/browser/profiles/gaia_info_update_service.h9
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc11
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.h6
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_tab_observer.cc21
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_tab_observer.h8
-rw-r--r--chrome/browser/ui/app_list/apps_model_builder.cc9
-rw-r--r--chrome/browser/ui/app_list/apps_model_builder.h6
-rw-r--r--chrome/browser/ui/browser_instant_controller.cc14
-rw-r--r--chrome/browser/ui/browser_instant_controller.h10
25 files changed, 96 insertions, 194 deletions
diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc
index 461a1d9..167392d 100644
--- a/chrome/browser/net/http_server_properties_manager.cc
+++ b/chrome/browser/net/http_server_properties_manager.cc
@@ -57,7 +57,10 @@ HttpServerPropertiesManager::HttpServerPropertiesManager(
ui_cache_update_timer_.reset(
new base::OneShotTimer<HttpServerPropertiesManager>);
pref_change_registrar_.Init(pref_service_);
- pref_change_registrar_.Add(prefs::kHttpServerProperties, this);
+ pref_change_registrar_.Add(
+ prefs::kHttpServerProperties,
+ base::Bind(&HttpServerPropertiesManager::OnHttpServerPropertiesChanged,
+ base::Unretained(this)));
}
HttpServerPropertiesManager::~HttpServerPropertiesManager() {
@@ -656,17 +659,10 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI(
completion.Run();
}
-void HttpServerPropertiesManager::OnPreferenceChanged(
- PrefServiceBase* prefs,
- const std::string& pref_name) {
+void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(prefs == pref_service_);
- if (pref_name == prefs::kHttpServerProperties) {
- if (!setting_prefs_)
- ScheduleUpdateCacheOnUI();
- } else {
- NOTREACHED();
- }
+ if (!setting_prefs_)
+ ScheduleUpdateCacheOnUI();
}
} // namespace chrome_browser_net
diff --git a/chrome/browser/net/http_server_properties_manager.h b/chrome/browser/net/http_server_properties_manager.h
index 07e34ba..d71813e 100644
--- a/chrome/browser/net/http_server_properties_manager.h
+++ b/chrome/browser/net/http_server_properties_manager.h
@@ -12,7 +12,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "base/timer.h"
#include "base/values.h"
#include "net/base/host_port_pair.h"
@@ -47,8 +46,7 @@ namespace chrome_browser_net {
// posted to IO from that method on UI. This is used to go through IO before
// the actual update starts, and grab a WeakPtr.
class HttpServerPropertiesManager
- : public net::HttpServerProperties,
- public PrefObserver {
+ : public net::HttpServerProperties {
public:
// Create an instance of the HttpServerPropertiesManager. The lifetime of the
// PrefService objects must be longer than that of the
@@ -194,9 +192,7 @@ class HttpServerPropertiesManager
const base::Closure& completion);
private:
- // Callback for preference changes.
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
+ void OnHttpServerPropertiesChanged();
// ---------
// UI thread
diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc
index e985609..7517323 100644
--- a/chrome/browser/net/net_pref_observer.cc
+++ b/chrome/browser/net/net_pref_observer.cc
@@ -23,9 +23,11 @@ NetPrefObserver::NetPrefObserver(PrefService* prefs,
DCHECK(prefs);
DCHECK(predictor);
+ base::Closure prefs_callback = base::Bind(&NetPrefObserver::ApplySettings,
+ base::Unretained(this));
network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled, prefs,
- this);
- spdy_disabled_.Init(prefs::kDisableSpdy, prefs, this);
+ prefs_callback);
+ spdy_disabled_.Init(prefs::kDisableSpdy, prefs, prefs_callback);
ApplySettings();
}
@@ -34,11 +36,6 @@ NetPrefObserver::~NetPrefObserver() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
-void NetPrefObserver::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- ApplySettings();
-}
-
void NetPrefObserver::ApplySettings() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/net/net_pref_observer.h b/chrome/browser/net/net_pref_observer.h
index 1d2f577..14e6b14 100644
--- a/chrome/browser/net/net_pref_observer.h
+++ b/chrome/browser/net/net_pref_observer.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_
#include "base/basictypes.h"
-#include "base/prefs/public/pref_observer.h"
#include "chrome/browser/api/prefs/pref_member.h"
namespace chrome_browser_net {
@@ -22,7 +21,7 @@ class PrefService;
// Monitors network-related preferences for changes and applies them.
// The supplied PrefService must outlive this NetPrefObserver.
// Must be used only on the UI thread.
-class NetPrefObserver : public PrefObserver {
+class NetPrefObserver {
public:
// |prefs| must be non-NULL and |*prefs| must outlive this.
// |prerender_manager| may be NULL. If not, |*prerender_manager| must
@@ -32,10 +31,6 @@ class NetPrefObserver : public PrefObserver {
chrome_browser_net::Predictor* predictor);
virtual ~NetPrefObserver();
- // PrefObserver
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
static void RegisterPrefs(PrefService* prefs);
private:
diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc
index 28d769c..411c879 100644
--- a/chrome/browser/net/ssl_config_service_manager_pref.cc
+++ b/chrome/browser/net/ssl_config_service_manager_pref.cc
@@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "chrome/browser/api/prefs/pref_member.h"
#include "chrome/browser/content_settings/content_settings_utils.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -143,8 +142,7 @@ void SSLConfigServicePref::SetNewSSLConfig(
// The manager for holding and updating an SSLConfigServicePref instance.
class SSLConfigServiceManagerPref
- : public SSLConfigServiceManager,
- public PrefObserver {
+ : public SSLConfigServiceManager {
public:
SSLConfigServiceManagerPref(PrefService* local_state,
PrefService* user_prefs);
@@ -158,8 +156,8 @@ class SSLConfigServiceManagerPref
private:
// Callback for preference changes. This will post the changes to the IO
// thread with SetNewSSLConfig.
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
+ void OnPreferenceChanged(PrefServiceBase* prefs,
+ const std::string& pref_name);
// Store SSL config settings in |config|, directly from the preferences. Must
// only be called from UI thread.
@@ -205,23 +203,38 @@ SSLConfigServiceManagerPref::SSLConfigServiceManagerPref(
ssl_config_service_(new SSLConfigServicePref()) {
DCHECK(local_state);
- rev_checking_enabled_.Init(prefs::kCertRevocationCheckingEnabled,
- local_state, this);
- ssl_version_min_.Init(prefs::kSSLVersionMin, local_state, this);
- ssl_version_max_.Init(prefs::kSSLVersionMax, local_state, this);
- channel_id_enabled_.Init(prefs::kEnableOriginBoundCerts, local_state, this);
- ssl_record_splitting_disabled_.Init(prefs::kDisableSSLRecordSplitting,
- local_state, this);
+ PrefChangeRegistrar::NamedChangeCallback local_state_callback = base::Bind(
+ &SSLConfigServiceManagerPref::OnPreferenceChanged,
+ base::Unretained(this),
+ local_state);
+
+ rev_checking_enabled_.Init(
+ prefs::kCertRevocationCheckingEnabled, local_state, local_state_callback);
+ ssl_version_min_.Init(
+ prefs::kSSLVersionMin, local_state, local_state_callback);
+ ssl_version_max_.Init(
+ prefs::kSSLVersionMax, local_state, local_state_callback);
+ channel_id_enabled_.Init(
+ prefs::kEnableOriginBoundCerts, local_state, local_state_callback);
+ ssl_record_splitting_disabled_.Init(
+ prefs::kDisableSSLRecordSplitting, local_state, local_state_callback);
+
local_state_change_registrar_.Init(local_state);
- local_state_change_registrar_.Add(prefs::kCipherSuiteBlacklist, this);
+ local_state_change_registrar_.Add(
+ prefs::kCipherSuiteBlacklist, local_state_callback);
OnDisabledCipherSuitesChange(local_state);
if (user_prefs) {
- block_third_party_cookies_.Init(prefs::kBlockThirdPartyCookies, user_prefs,
- this);
+ PrefChangeRegistrar::NamedChangeCallback user_prefs_callback = base::Bind(
+ &SSLConfigServiceManagerPref::OnPreferenceChanged,
+ base::Unretained(this),
+ user_prefs);
+ block_third_party_cookies_.Init(
+ prefs::kBlockThirdPartyCookies, user_prefs, user_prefs_callback);
user_prefs_change_registrar_.Init(user_prefs);
- user_prefs_change_registrar_.Add(prefs::kDefaultContentSettings, this);
+ user_prefs_change_registrar_.Add(
+ prefs::kDefaultContentSettings, user_prefs_callback);
OnDefaultContentSettingsChange(user_prefs);
}
diff --git a/chrome/browser/policy/cloud_policy_refresh_scheduler.cc b/chrome/browser/policy/cloud_policy_refresh_scheduler.cc
index 6397f8e..8132be5 100644
--- a/chrome/browser/policy/cloud_policy_refresh_scheduler.cc
+++ b/chrome/browser/policy/cloud_policy_refresh_scheduler.cc
@@ -37,7 +37,10 @@ CloudPolicyRefreshScheduler::CloudPolicyRefreshScheduler(
store_->AddObserver(this);
net::NetworkChangeNotifier::AddIPAddressObserver(this);
- refresh_delay_.Init(refresh_pref.c_str(), prefs, this);
+ refresh_delay_.Init(
+ refresh_pref.c_str(), prefs,
+ base::Bind(&CloudPolicyRefreshScheduler::ScheduleRefresh,
+ base::Unretained(this)));
UpdateLastRefreshFromPolicy();
ScheduleRefresh();
@@ -99,14 +102,6 @@ void CloudPolicyRefreshScheduler::OnStoreError(CloudPolicyStore* store) {
// error is required. NB: Changes to is_managed fire OnStoreLoaded().
}
-void CloudPolicyRefreshScheduler::OnPreferenceChanged(
- PrefServiceBase* service,
- const std::string& pref_name) {
- DCHECK_EQ(refresh_delay_.GetPrefName(), pref_name);
-
- ScheduleRefresh();
-}
-
void CloudPolicyRefreshScheduler::OnIPAddressChanged() {
if (client_->status() == DM_STATUS_REQUEST_FAILED)
RefreshAfter(0);
diff --git a/chrome/browser/policy/cloud_policy_refresh_scheduler.h b/chrome/browser/policy/cloud_policy_refresh_scheduler.h
index aaba6c1..e2ecb6e 100644
--- a/chrome/browser/policy/cloud_policy_refresh_scheduler.h
+++ b/chrome/browser/policy/cloud_policy_refresh_scheduler.h
@@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/cancelable_callback.h"
#include "base/memory/ref_counted.h"
-#include "base/prefs/public/pref_observer.h"
#include "base/time.h"
#include "chrome/browser/api/prefs/pref_member.h"
#include "chrome/browser/policy/cloud_policy_client.h"
@@ -30,7 +29,6 @@ namespace policy {
class CloudPolicyRefreshScheduler
: public CloudPolicyClient::Observer,
public CloudPolicyStore::Observer,
- public PrefObserver,
public net::NetworkChangeNotifier::IPAddressObserver {
public:
// Refresh constants.
@@ -60,10 +58,6 @@ class CloudPolicyRefreshScheduler
virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE;
virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE;
- // PrefObserver:
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
// net::NetworkChangeNotifier::IPAddressObserver:
virtual void OnIPAddressChanged() OVERRIDE;
diff --git a/chrome/browser/policy/cloud_policy_subsystem.cc b/chrome/browser/policy/cloud_policy_subsystem.cc
index a937508..272ac06 100644
--- a/chrome/browser/policy/cloud_policy_subsystem.cc
+++ b/chrome/browser/policy/cloud_policy_subsystem.cc
@@ -103,7 +103,10 @@ void CloudPolicySubsystem::CompleteInitialization(
PrefService* local_state = g_browser_process->local_state();
DCHECK(pref_change_registrar_.IsEmpty());
pref_change_registrar_.Init(local_state);
- pref_change_registrar_.Add(refresh_pref_name_, this);
+ pref_change_registrar_.Add(
+ refresh_pref_name_,
+ base::Bind(&CloudPolicySubsystem::OnRefreshPrefChanged,
+ base::Unretained(this)));
UpdatePolicyRefreshRate(local_state->GetInteger(refresh_pref_name_));
}
}
@@ -158,11 +161,8 @@ void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) {
}
}
-void CloudPolicySubsystem::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- DCHECK_EQ(pref_name, refresh_pref_name_);
+void CloudPolicySubsystem::OnRefreshPrefChanged() {
PrefService* local_state = g_browser_process->local_state();
- DCHECK_EQ(service, local_state);
UpdatePolicyRefreshRate(local_state->GetInteger(refresh_pref_name_));
}
diff --git a/chrome/browser/policy/cloud_policy_subsystem.h b/chrome/browser/policy/cloud_policy_subsystem.h
index 2ff3eab..949fd2e 100644
--- a/chrome/browser/policy/cloud_policy_subsystem.h
+++ b/chrome/browser/policy/cloud_policy_subsystem.h
@@ -7,7 +7,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "net/base/network_change_notifier.h"
class PrefService;
@@ -25,8 +24,7 @@ class PolicyNotifier;
// policy. It glues together the backend, the policy controller and manages the
// life cycle of the policy providers.
class CloudPolicySubsystem
- : public PrefObserver,
- public net::NetworkChangeNotifier::IPAddressObserver {
+ : public net::NetworkChangeNotifier::IPAddressObserver {
public:
enum PolicySubsystemState {
UNENROLLED, // No enrollment attempt has been performed yet.
@@ -131,9 +129,7 @@ class CloudPolicySubsystem
virtual void CreateDeviceTokenFetcher();
virtual void CreateCloudPolicyController();
- // PrefObserver overrides.
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
+ void OnRefreshPrefChanged();
// net::NetworkChangeNotifier::IPAddressObserver:
virtual void OnIPAddressChanged() OVERRIDE;
diff --git a/chrome/browser/policy/url_blacklist_manager.cc b/chrome/browser/policy/url_blacklist_manager.cc
index d175ebf..272e6f1 100644
--- a/chrome/browser/policy/url_blacklist_manager.cc
+++ b/chrome/browser/policy/url_blacklist_manager.cc
@@ -278,8 +278,10 @@ URLBlacklistManager::URLBlacklistManager(PrefService* pref_service)
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
pref_change_registrar_.Init(pref_service_);
- pref_change_registrar_.Add(prefs::kUrlBlacklist, this);
- pref_change_registrar_.Add(prefs::kUrlWhitelist, this);
+ base::Closure callback = base::Bind(&URLBlacklistManager::ScheduleUpdate,
+ base::Unretained(this));
+ pref_change_registrar_.Add(prefs::kUrlBlacklist, callback);
+ pref_change_registrar_.Add(prefs::kUrlWhitelist, callback);
// Start enforcing the policies without a delay when they are present at
// startup.
@@ -297,15 +299,6 @@ void URLBlacklistManager::ShutdownOnUIThread() {
URLBlacklistManager::~URLBlacklistManager() {
}
-void URLBlacklistManager::OnPreferenceChanged(PrefServiceBase* prefs,
- const std::string& pref_name) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(prefs == pref_service_);
- DCHECK(pref_name == prefs::kUrlBlacklist ||
- pref_name == prefs::kUrlWhitelist);
- ScheduleUpdate();
-}
-
void URLBlacklistManager::ScheduleUpdate() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Cancel pending updates, if any. This can happen if two preferences that
diff --git a/chrome/browser/policy/url_blacklist_manager.h b/chrome/browser/policy/url_blacklist_manager.h
index 9bbf47c..b2f6f83 100644
--- a/chrome/browser/policy/url_blacklist_manager.h
+++ b/chrome/browser/policy/url_blacklist_manager.h
@@ -15,7 +15,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "chrome/common/extensions/matcher/url_matcher.h"
class GURL;
@@ -113,7 +112,7 @@ class URLBlacklist {
// exists in UI, then a potential destruction on IO will come after any task
// posted to IO from that method on UI. This is used to go through IO before
// the actual update starts, and grab a WeakPtr.
-class URLBlacklistManager : public PrefObserver {
+class URLBlacklistManager {
public:
// Must be constructed on the UI thread.
explicit URLBlacklistManager(PrefService* pref_service);
@@ -148,9 +147,6 @@ class URLBlacklistManager : public PrefObserver {
scoped_ptr<base::ListValue> allow);
private:
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
// ---------
// UI thread
// ---------
diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
index 18ed40d..cf16173 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
@@ -89,7 +89,12 @@ void CloudPrintProxyService::Initialize() {
}
pref_change_registrar_.Init(profile_->GetPrefs());
- pref_change_registrar_.Add(prefs::kCloudPrintProxyEnabled, this);
+ pref_change_registrar_.Add(
+ prefs::kCloudPrintProxyEnabled,
+ base::Bind(
+ base::IgnoreResult(
+ &CloudPrintProxyService::ApplyCloudPrintConnectorPolicy),
+ base::Unretained(this)));
}
void CloudPrintProxyService::RefreshStatusFromService() {
@@ -207,11 +212,6 @@ void CloudPrintProxyService::OnCloudPrintSetupClosed() {
FROM_HERE, base::Bind(&browser::EndKeepAlive));
}
-void CloudPrintProxyService::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- ApplyCloudPrintConnectorPolicy();
-}
-
void CloudPrintProxyService::RefreshCloudPrintProxyStatus() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ServiceProcessControl* process_control = GetServiceProcessControl();
diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
index e12a942..8f5b470 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
+++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
@@ -13,7 +13,6 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
@@ -28,8 +27,7 @@ struct CloudPrintProxyInfo;
// running in the service process.
class CloudPrintProxyService
: public CloudPrintSetupHandlerDelegate,
- public ProfileKeyedService,
- public PrefObserver {
+ public ProfileKeyedService {
public:
explicit CloudPrintProxyService(Profile* profile);
virtual ~CloudPrintProxyService();
@@ -63,10 +61,6 @@ class CloudPrintProxyService
// CloudPrintSetupHandler::Delegate implementation.
virtual void OnCloudPrintSetupClosed() OVERRIDE;
- // PrefObserver implementation.
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
private:
// NotificationDelegate implementation for the token expired notification.
class TokenExpiredNotificationDelegate;
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 410c1f4..bddbeb9 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -80,9 +80,11 @@ PrintViewManager::PrintViewManager(content::WebContents* web_contents)
content::Source<content::WebContents>(web_contents));
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- printing_enabled_.Init(prefs::kPrintingEnabled,
- profile->GetPrefs(),
- this);
+ printing_enabled_.Init(
+ prefs::kPrintingEnabled,
+ profile->GetPrefs(),
+ base::Bind(&PrintViewManager::UpdateScriptedPrintingBlocked,
+ base::Unretained(this)));
}
PrintViewManager::~PrintViewManager() {
@@ -394,11 +396,6 @@ void PrintViewManager::Observe(int type,
}
}
-void PrintViewManager::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- UpdateScriptedPrintingBlocked();
-}
-
void PrintViewManager::OnNotifyPrintJobEvent(
const JobEventDetails& event_details) {
switch (event_details.type()) {
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index d83c1a3..e23eaab 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
#include "base/memory/ref_counted.h"
-#include "base/prefs/public/pref_observer.h"
#include "base/string16.h"
#include "chrome/browser/api/prefs/pref_member.h"
#include "content/public/browser/notification_observer.h"
@@ -31,7 +30,6 @@ class PrintViewManagerObserver;
// Manages the print commands for a WebContents.
class PrintViewManager : public content::NotificationObserver,
- public PrefObserver,
public PrintedPagesSource,
public content::WebContentsObserver,
public content::WebContentsUserData<PrintViewManager> {
@@ -79,10 +77,6 @@ class PrintViewManager : public content::NotificationObserver,
// must be NULL if |observer| is non-NULL.
void set_observer(PrintViewManagerObserver* observer);
- // PrefObserver implementation.
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
// PrintedPagesSource implementation.
virtual string16 RenderSourceName() OVERRIDE;
diff --git a/chrome/browser/profiles/gaia_info_update_service.cc b/chrome/browser/profiles/gaia_info_update_service.cc
index 4d8b4a8..f555991 100644
--- a/chrome/browser/profiles/gaia_info_update_service.cc
+++ b/chrome/browser/profiles/gaia_info_update_service.cc
@@ -32,7 +32,9 @@ const int kMinUpdateIntervalSeconds = 5;
GAIAInfoUpdateService::GAIAInfoUpdateService(Profile* profile)
: profile_(profile) {
PrefService* prefs = profile_->GetPrefs();
- username_pref_.Init(prefs::kGoogleServicesUsername, prefs, this);
+ username_pref_.Init(prefs::kGoogleServicesUsername, prefs,
+ base::Bind(&GAIAInfoUpdateService::OnUsernameChanged,
+ base::Unretained(this)));
last_updated_ = base::Time::FromInternalValue(
prefs->GetInt64(prefs::kProfileGAIAInfoUpdateTime));
@@ -164,12 +166,6 @@ void GAIAInfoUpdateService::OnProfileDownloadFailure(
ScheduleNextUpdate();
}
-void GAIAInfoUpdateService::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- if (prefs::kGoogleServicesUsername == pref_name)
- OnUsernameChanged();
-}
-
void GAIAInfoUpdateService::OnUsernameChanged() {
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
diff --git a/chrome/browser/profiles/gaia_info_update_service.h b/chrome/browser/profiles/gaia_info_update_service.h
index bd4ca60..8085b77 100644
--- a/chrome/browser/profiles/gaia_info_update_service.h
+++ b/chrome/browser/profiles/gaia_info_update_service.h
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
-#include "base/prefs/public/pref_observer.h"
#include "base/timer.h"
#include "chrome/browser/api/prefs/pref_member.h"
#include "chrome/browser/profiles/profile_downloader.h"
@@ -19,8 +18,7 @@ class ProfileDownloader;
// This service kicks off a download of the user's name and profile picture.
// The results are saved in the profile info cache.
-class GAIAInfoUpdateService : public ProfileDownloaderDelegate,
- public PrefObserver {
+class GAIAInfoUpdateService : public ProfileDownloaderDelegate {
public:
explicit GAIAInfoUpdateService(Profile* profile);
virtual ~GAIAInfoUpdateService();
@@ -45,11 +43,6 @@ class GAIAInfoUpdateService : public ProfileDownloaderDelegate,
private:
FRIEND_TEST_ALL_PREFIXES(GAIAInfoUpdateServiceTest, ScheduleUpdate);
- // PrefObserver:
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
-
void OnUsernameChanged();
void ScheduleNextUpdate();
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index f22ac5e..73b1506 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -1375,13 +1375,6 @@ void SafeBrowsingService::Observe(int type,
}
}
-void SafeBrowsingService::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(pref_name == prefs::kSafeBrowsingEnabled);
- RefreshState();
-}
-
bool SafeBrowsingService::IsWhitelisted(const UnsafeResource& resource) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Check if the user has already ignored our warning for this render_view
@@ -1412,7 +1405,9 @@ void SafeBrowsingService::AddPrefService(PrefService* pref_service) {
DCHECK(prefs_map_.find(pref_service) == prefs_map_.end());
PrefChangeRegistrar* registrar = new PrefChangeRegistrar();
registrar->Init(pref_service);
- registrar->Add(prefs::kSafeBrowsingEnabled, this);
+ registrar->Add(prefs::kSafeBrowsingEnabled,
+ base::Bind(&SafeBrowsingService::RefreshState,
+ base::Unretained(this)));
prefs_map_[pref_service] = registrar;
RefreshState();
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index 8ea28c9..4d9d014 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -20,7 +20,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
-#include "base/prefs/public/pref_observer.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/synchronization/lock.h"
#include "base/time.h"
@@ -58,7 +57,6 @@ class SafeBrowsingService
: public base::RefCountedThreadSafe<
SafeBrowsingService, content::BrowserThread::DeleteOnUIThread>,
public content::NotificationObserver,
- public PrefObserver,
public SafeBrowsingProtocolManagerDelegate {
public:
class Client;
@@ -465,10 +463,6 @@ class SafeBrowsingService
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // PrefObserver override
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
// SafeBrowsingProtocolManageDelegate override
virtual void ResetDatabase() OVERRIDE;
virtual void UpdateStarted() OVERRIDE;
diff --git a/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc b/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
index 06d4ca1..113e3b1 100644
--- a/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
@@ -38,7 +38,10 @@ SafeBrowsingTabObserver::SafeBrowsingTabObserver(
PrefService* prefs = profile->GetPrefs();
if (prefs) {
pref_change_registrar_.Init(prefs);
- pref_change_registrar_.Add(prefs::kSafeBrowsingEnabled, this);
+ pref_change_registrar_.Add(
+ prefs::kSafeBrowsingEnabled,
+ base::Bind(&SafeBrowsingTabObserver::UpdateSafebrowsingDetectionHost,
+ base::Unretained(this)));
if (prefs->GetBoolean(prefs::kSafeBrowsingEnabled) &&
g_browser_process->safe_browsing_detection_service()) {
@@ -53,22 +56,6 @@ SafeBrowsingTabObserver::~SafeBrowsingTabObserver() {
}
////////////////////////////////////////////////////////////////////////////////
-// content::NotificationObserver overrides
-
-void SafeBrowsingTabObserver::OnPreferenceChanged(
- PrefServiceBase* service,
- const std::string& pref_name) {
- Profile* profile =
- Profile::FromBrowserContext(web_contents_->GetBrowserContext());
- DCHECK(service == profile->GetPrefs());
- if (pref_name == prefs::kSafeBrowsingEnabled) {
- UpdateSafebrowsingDetectionHost();
- } else {
- NOTREACHED() << "unexpected pref change notification" << pref_name;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
// Internal helpers
void SafeBrowsingTabObserver::UpdateSafebrowsingDetectionHost() {
diff --git a/chrome/browser/safe_browsing/safe_browsing_tab_observer.h b/chrome/browser/safe_browsing/safe_browsing_tab_observer.h
index b41ecb9..45e7be4 100644
--- a/chrome/browser/safe_browsing/safe_browsing_tab_observer.h
+++ b/chrome/browser/safe_browsing/safe_browsing_tab_observer.h
@@ -7,7 +7,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "content/public/browser/web_contents_user_data.h"
namespace content {
@@ -20,8 +19,7 @@ class ClientSideDetectionHost;
// Per-tab class to handle safe-browsing functionality.
class SafeBrowsingTabObserver
- : public PrefObserver,
- public content::WebContentsUserData<SafeBrowsingTabObserver> {
+ : public content::WebContentsUserData<SafeBrowsingTabObserver> {
public:
virtual ~SafeBrowsingTabObserver();
@@ -29,10 +27,6 @@ class SafeBrowsingTabObserver
explicit SafeBrowsingTabObserver(content::WebContents* web_contents);
friend class content::WebContentsUserData<SafeBrowsingTabObserver>;
- // PrefObserver overrides:
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
// Internal helpers ----------------------------------------------------------
// Create or destroy SafebrowsingDetectionHost as needed if the user's
diff --git a/chrome/browser/ui/app_list/apps_model_builder.cc b/chrome/browser/ui/app_list/apps_model_builder.cc
index 6932c70..8694caa 100644
--- a/chrome/browser/ui/app_list/apps_model_builder.cc
+++ b/chrome/browser/ui/app_list/apps_model_builder.cc
@@ -57,7 +57,9 @@ AppsModelBuilder::AppsModelBuilder(Profile* profile,
content::Source<Profile>(profile_));
pref_change_registrar_.Init(extension_prefs->pref_service());
- pref_change_registrar_.Add(extensions::ExtensionPrefs::kExtensionsPref, this);
+ pref_change_registrar_.Add(extensions::ExtensionPrefs::kExtensionsPref,
+ base::Bind(&AppsModelBuilder::ResortApps,
+ base::Unretained(this)));
model_->AddObserver(this);
}
@@ -213,11 +215,6 @@ void AppsModelBuilder::Observe(int type,
}
}
-void AppsModelBuilder::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- ResortApps();
-}
-
void AppsModelBuilder::ListItemsAdded(size_t start, size_t count) {
}
diff --git a/chrome/browser/ui/app_list/apps_model_builder.h b/chrome/browser/ui/app_list/apps_model_builder.h
index b943a9a..5c91583 100644
--- a/chrome/browser/ui/app_list/apps_model_builder.h
+++ b/chrome/browser/ui/app_list/apps_model_builder.h
@@ -9,7 +9,6 @@
#include "base/gtest_prod_util.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/app_list/app_list_model.h"
@@ -20,7 +19,6 @@ class ExtensionAppItem;
class Profile;
class AppsModelBuilder : public content::NotificationObserver,
- public PrefObserver,
public ui::ListModelObserver {
public:
AppsModelBuilder(Profile* profile,
@@ -58,10 +56,6 @@ class AppsModelBuilder : public content::NotificationObserver,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // PrefObserver
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
-
// ui::ListModelObserver overrides:
virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE;
virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE;
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index 96c2755..e8f9dba 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -42,8 +42,11 @@ BrowserInstantController::BrowserInstantController(Browser* browser)
initialized_theme_info_(false),
theme_area_height_(0) {
profile_pref_registrar_.Init(browser_->profile()->GetPrefs());
- profile_pref_registrar_.Add(prefs::kInstantEnabled, this);
- instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile()));
+ profile_pref_registrar_.Add(
+ prefs::kInstantEnabled,
+ base::Bind(&BrowserInstantController::ResetInstant,
+ base::Unretained(this)));
+ ResetInstant();
browser_->search_model()->AddObserver(this);
#if defined(ENABLE_THEMES)
@@ -148,12 +151,7 @@ void BrowserInstantController::UpdateThemeInfoForPreview() {
OnThemeChanged(NULL);
}
-////////////////////////////////////////////////////////////////////////////////
-// BrowserInstantController, PrefObserver implementation:
-
-void BrowserInstantController::OnPreferenceChanged(
- PrefServiceBase* service,
- const std::string& pref_name) {
+void BrowserInstantController::ResetInstant() {
instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile()));
}
diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h
index a769f07..ef23d3a 100644
--- a/chrome/browser/ui/browser_instant_controller.h
+++ b/chrome/browser/ui/browser_instant_controller.h
@@ -8,7 +8,6 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/prefs/public/pref_change_registrar.h"
-#include "base/prefs/public/pref_observer.h"
#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/instant/instant_unload_handler.h"
#include "chrome/browser/ui/search/search_model_observer.h"
@@ -29,8 +28,7 @@ class Rect;
namespace chrome {
-class BrowserInstantController : public PrefObserver,
- public content::NotificationObserver,
+class BrowserInstantController : public content::NotificationObserver,
public search::SearchModelObserver {
public:
explicit BrowserInstantController(Browser* browser);
@@ -81,9 +79,9 @@ class BrowserInstantController : public PrefObserver,
void UpdateThemeInfoForPreview();
private:
- // Overridden from PrefObserver:
- virtual void OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) OVERRIDE;
+ // Sets the value of |instant_| based on value from profile. Invoked
+ // on pref change.
+ void ResetInstant();
// Overridden from search::SearchModelObserver:
virtual void ModeChanged(const search::Mode& old_mode,