| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/google/google_util.h" | 7 #include "chrome/browser/google/google_util.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.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" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 | 15 |
| 16 using content::RenderViewHost; |
| 16 using content::WebContents; | 17 using content::WebContents; |
| 17 | 18 |
| 18 AlternateErrorPageTabObserver::AlternateErrorPageTabObserver( | 19 AlternateErrorPageTabObserver::AlternateErrorPageTabObserver( |
| 19 WebContents* web_contents) | 20 WebContents* web_contents) |
| 20 : content::WebContentsObserver(web_contents) { | 21 : content::WebContentsObserver(web_contents) { |
| 21 PrefService* prefs = GetProfile()->GetPrefs(); | 22 PrefService* prefs = GetProfile()->GetPrefs(); |
| 22 if (prefs) { | 23 if (prefs) { |
| 23 pref_change_registrar_.Init(prefs); | 24 pref_change_registrar_.Init(prefs); |
| 24 pref_change_registrar_.Add(prefs::kAlternateErrorPagesEnabled, this); | 25 pref_change_registrar_.Add(prefs::kAlternateErrorPagesEnabled, this); |
| 25 } | 26 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 GURL(google_util::kLinkDoctorBaseURL)); | 92 GURL(google_util::kLinkDoctorBaseURL)); |
| 92 url = google_util::AppendGoogleTLDParam(url); | 93 url = google_util::AppendGoogleTLDParam(url); |
| 93 } | 94 } |
| 94 return url; | 95 return url; |
| 95 } | 96 } |
| 96 | 97 |
| 97 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( | 98 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( |
| 98 RenderViewHost* rvh) { | 99 RenderViewHost* rvh) { |
| 99 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); | 100 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); |
| 100 } | 101 } |
| OLD | NEW |