| OLD | NEW |
| 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/alternate_error_tab_observer.h" | 5 #include "chrome/browser/ui/alternate_error_tab_observer.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, | 36 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, |
| 37 content::Source<Profile>(profile_->GetOriginalProfile())); | 37 content::Source<Profile>(profile_->GetOriginalProfile())); |
| 38 } | 38 } |
| 39 | 39 |
| 40 AlternateErrorPageTabObserver::~AlternateErrorPageTabObserver() { | 40 AlternateErrorPageTabObserver::~AlternateErrorPageTabObserver() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 // static | 43 // static |
| 44 void AlternateErrorPageTabObserver::RegisterUserPrefs( | 44 void AlternateErrorPageTabObserver::RegisterProfilePrefs( |
| 45 user_prefs::PrefRegistrySyncable* prefs) { | 45 user_prefs::PrefRegistrySyncable* prefs) { |
| 46 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, | 46 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, |
| 47 true, | 47 true, |
| 48 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 48 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 49 } | 49 } |
| 50 | 50 |
| 51 //////////////////////////////////////////////////////////////////////////////// | 51 //////////////////////////////////////////////////////////////////////////////// |
| 52 // WebContentsObserver overrides | 52 // WebContentsObserver overrides |
| 53 | 53 |
| 54 void AlternateErrorPageTabObserver::RenderViewCreated( | 54 void AlternateErrorPageTabObserver::RenderViewCreated( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() { | 89 void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() { |
| 90 UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost()); | 90 UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( | 93 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( |
| 94 RenderViewHost* rvh) { | 94 RenderViewHost* rvh) { |
| 95 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); | 95 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); |
| 96 } | 96 } |
| OLD | NEW |