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 24 matching lines...) Expand all Loading... |
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::RegisterUserPrefs( |
45 PrefRegistrySyncable* prefs) { | 45 user_prefs::PrefRegistrySyncable* prefs) { |
46 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, true, | 46 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, |
47 PrefRegistrySyncable::SYNCABLE_PREF); | 47 true, |
| 48 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
48 } | 49 } |
49 | 50 |
50 //////////////////////////////////////////////////////////////////////////////// | 51 //////////////////////////////////////////////////////////////////////////////// |
51 // WebContentsObserver overrides | 52 // WebContentsObserver overrides |
52 | 53 |
53 void AlternateErrorPageTabObserver::RenderViewCreated( | 54 void AlternateErrorPageTabObserver::RenderViewCreated( |
54 RenderViewHost* render_view_host) { | 55 RenderViewHost* render_view_host) { |
55 UpdateAlternateErrorPageURL(render_view_host); | 56 UpdateAlternateErrorPageURL(render_view_host); |
56 } | 57 } |
57 | 58 |
(...skipping 28 matching lines...) Expand all Loading... |
86 } | 87 } |
87 | 88 |
88 void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() { | 89 void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() { |
89 UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost()); | 90 UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost()); |
90 } | 91 } |
91 | 92 |
92 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( | 93 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( |
93 RenderViewHost* rvh) { | 94 RenderViewHost* rvh) { |
94 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); | 95 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); |
95 } | 96 } |
OLD | NEW |