summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/alternate_error_tab_observer.cc
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 20:08:02 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 20:08:02 +0000
commit0b085c40e699bd8bfcad31a9eb0303437f0c5e93 (patch)
tree56dee99bada0c6c2ece5613afbacd97776f64b8a /chrome/browser/ui/alternate_error_tab_observer.cc
parent3a8d7fa918f77e913778628a988c5687cf0d9fa4 (diff)
downloadchromium_src-0b085c40e699bd8bfcad31a9eb0303437f0c5e93.zip
chromium_src-0b085c40e699bd8bfcad31a9eb0303437f0c5e93.tar.gz
chromium_src-0b085c40e699bd8bfcad31a9eb0303437f0c5e93.tar.bz2
Revert 170483 - Remove PrefObserver usages, batch 12.
TBR=ben@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/11280115 Reason for revert: A review comment after commit showed that the change is probably wrong (or at least changes behavior in a way that was not intended). Reverting for now, until there is time to figure out the correct change. TBR=joi@chromium.org Review URL: https://codereview.chromium.org/11308295 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170519 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/alternate_error_tab_observer.cc')
-rw-r--r--chrome/browser/ui/alternate_error_tab_observer.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc
index 6bac4c3..569a739 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.cc
+++ b/chrome/browser/ui/alternate_error_tab_observer.cc
@@ -25,11 +25,7 @@ AlternateErrorPageTabObserver::AlternateErrorPageTabObserver(
PrefService* prefs = profile_->GetPrefs();
if (prefs) {
pref_change_registrar_.Init(prefs);
- pref_change_registrar_.Add(
- prefs::kAlternateErrorPagesEnabled,
- base::Bind(&AlternateErrorPageTabObserver::
- OnAlternateErrorPagesEnabledChanged,
- base::Unretained(this)));
+ pref_change_registrar_.Add(prefs::kAlternateErrorPagesEnabled, this);
}
registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
@@ -65,6 +61,17 @@ void AlternateErrorPageTabObserver::Observe(
}
////////////////////////////////////////////////////////////////////////////////
+// PrefObserver overrides
+
+void AlternateErrorPageTabObserver::OnPreferenceChanged(
+ PrefServiceBase* service,
+ const std::string& pref_name) {
+ DCHECK_EQ(profile_->GetPrefs(), service);
+ DCHECK(prefs::kAlternateErrorPagesEnabled == pref_name);
+ UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost());
+}
+
+////////////////////////////////////////////////////////////////////////////////
// Internal helpers
GURL AlternateErrorPageTabObserver::GetAlternateErrorPageURL() const {
@@ -83,10 +90,6 @@ GURL AlternateErrorPageTabObserver::GetAlternateErrorPageURL() const {
return url;
}
-void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() {
- UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost());
-}
-
void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL(
RenderViewHost* rvh) {
rvh->SetAltErrorPageURL(GetAlternateErrorPageURL());