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