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_PREFS_PREFS_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/prefs/pref_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.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 OverlayUserPrefStore; | 14 class OverlayUserPrefStore; |
15 class PrefRegistrySyncable; | |
16 class PrefService; | 15 class PrefService; |
17 class Profile; | 16 class Profile; |
18 | 17 |
19 namespace content { | 18 namespace content { |
20 class WebContents; | 19 class WebContents; |
21 } | 20 } |
22 | 21 |
| 22 namespace user_prefs { |
| 23 class PrefRegistrySyncable; |
| 24 } |
| 25 |
23 // Per-tab class to handle user preferences. | 26 // Per-tab class to handle user preferences. |
24 class PrefsTabHelper : public content::NotificationObserver, | 27 class PrefsTabHelper : public content::NotificationObserver, |
25 public content::WebContentsUserData<PrefsTabHelper> { | 28 public content::WebContentsUserData<PrefsTabHelper> { |
26 public: | 29 public: |
27 virtual ~PrefsTabHelper(); | 30 virtual ~PrefsTabHelper(); |
28 | 31 |
29 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); | 32 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); |
30 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 33 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
31 static void MigrateUserPrefs(PrefService* prefs); | 34 static void MigrateUserPrefs(PrefService* prefs); |
32 | 35 |
33 protected: | 36 protected: |
34 // Update the RenderView's WebPreferences. Exposed as protected for testing. | 37 // Update the RenderView's WebPreferences. Exposed as protected for testing. |
35 virtual void UpdateWebPreferences(); | 38 virtual void UpdateWebPreferences(); |
36 | 39 |
37 private: | 40 private: |
38 explicit PrefsTabHelper(content::WebContents* contents); | 41 explicit PrefsTabHelper(content::WebContents* contents); |
39 friend class content::WebContentsUserData<PrefsTabHelper>; | 42 friend class content::WebContentsUserData<PrefsTabHelper>; |
40 | 43 |
41 // content::NotificationObserver overrides: | 44 // content::NotificationObserver overrides: |
42 virtual void Observe(int type, | 45 virtual void Observe(int type, |
43 const content::NotificationSource& source, | 46 const content::NotificationSource& source, |
44 const content::NotificationDetails& details) OVERRIDE; | 47 const content::NotificationDetails& details) OVERRIDE; |
45 | 48 |
46 // Update the WebContents's RendererPreferences. | 49 // Update the WebContents's RendererPreferences. |
47 void UpdateRendererPreferences(); | 50 void UpdateRendererPreferences(); |
48 | 51 |
49 Profile* GetProfile(); | 52 Profile* GetProfile(); |
50 void OnWebPrefChanged(const std::string& pref_name); | 53 void OnWebPrefChanged(const std::string& pref_name); |
51 | 54 |
52 content::WebContents* web_contents_; | 55 content::WebContents* web_contents_; |
53 content::NotificationRegistrar registrar_; | 56 content::NotificationRegistrar registrar_; |
54 PrefChangeRegistrar pref_change_registrar_; | 57 PrefChangeRegistrar pref_change_registrar_; |
55 | 58 |
56 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); | 59 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); |
57 }; | 60 }; |
58 | 61 |
59 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ | 62 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ |
OLD | NEW |