| 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 #ifndef CHROME_BROWSER_UI_ALTERNATE_ERROR_TAB_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_UI_LINK_DOCTOR_TAB_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_UI_ALTERNATE_ERROR_TAB_OBSERVER_H_ | 6 #define CHROME_BROWSER_UI_LINK_DOCTOR_TAB_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/prefs/pref_change_registrar.h" | 8 #include "base/prefs/pref_change_registrar.h" |
| 9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
| 10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace user_prefs { | 16 namespace user_prefs { |
| 17 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // Per-tab class to implement alternate error page functionality. | 20 // Per-tab class to implement Link Doctor functionality. |
| 21 class AlternateErrorPageTabObserver | 21 class LinkDoctorTabObserver |
| 22 : public content::WebContentsObserver, | 22 : public content::WebContentsObserver, |
| 23 public content::NotificationObserver, | 23 public content::NotificationObserver, |
| 24 public content::WebContentsUserData<AlternateErrorPageTabObserver> { | 24 public content::WebContentsUserData<LinkDoctorTabObserver> { |
| 25 public: | 25 public: |
| 26 virtual ~AlternateErrorPageTabObserver(); | 26 virtual ~LinkDoctorTabObserver(); |
| 27 | 27 |
| 28 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 28 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 explicit AlternateErrorPageTabObserver(content::WebContents* web_contents); | 31 explicit LinkDoctorTabObserver(content::WebContents* web_contents); |
| 32 friend class content::WebContentsUserData<AlternateErrorPageTabObserver>; | 32 friend class content::WebContentsUserData<LinkDoctorTabObserver>; |
| 33 | 33 |
| 34 // content::WebContentsObserver overrides: | 34 // content::WebContentsObserver overrides: |
| 35 virtual void RenderViewCreated( | 35 virtual void RenderViewCreated( |
| 36 content::RenderViewHost* render_view_host) OVERRIDE; | 36 content::RenderViewHost* render_view_host) OVERRIDE; |
| 37 | 37 |
| 38 // content::NotificationObserver overrides: | 38 // content::NotificationObserver overrides: |
| 39 virtual void Observe(int type, | 39 virtual void Observe(int type, |
| 40 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
| 41 const content::NotificationDetails& details) OVERRIDE; | 41 const content::NotificationDetails& details) OVERRIDE; |
| 42 | 42 |
| 43 // Internal helpers ---------------------------------------------------------- | 43 // Internal helpers ---------------------------------------------------------- |
| 44 | 44 |
| 45 // Returns the server that can provide alternate error pages. If the returned | 45 // Returns the URL for the Link Doctor FixURL service. If the returned URL |
| 46 // URL is empty, the default error page built into WebKit will be used. | 46 // is empty, the default error pages will be used. |
| 47 GURL GetAlternateErrorPageURL() const; | 47 GURL GetLinkDoctorURL() const; |
| 48 | 48 |
| 49 void OnAlternateErrorPagesEnabledChanged(); | 49 void OnLinkDoctorEnabledChanged(); |
| 50 | 50 |
| 51 // Send the alternate error page URL to the renderer. | 51 // Updates the renderer's Link Doctor FixURL service configuration. |
| 52 void UpdateAlternateErrorPageURL(content::RenderViewHost* rvh); | 52 void UpdateLinkDoctorInfo(content::RenderViewHost* rvh); |
| 53 | 53 |
| 54 Profile* profile_; | 54 Profile* profile_; |
| 55 content::NotificationRegistrar registrar_; | 55 content::NotificationRegistrar registrar_; |
| 56 PrefChangeRegistrar pref_change_registrar_; | 56 PrefChangeRegistrar pref_change_registrar_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(AlternateErrorPageTabObserver); | 58 DISALLOW_COPY_AND_ASSIGN(LinkDoctorTabObserver); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_UI_ALTERNATE_ERROR_TAB_OBSERVER_H_ | 61 #endif // CHROME_BROWSER_UI_ALTERNATE_ERROR_TAB_OBSERVER_H_ |
| OLD | NEW |