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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/prefs/pref_change_registrar.h" | 10 #include "chrome/browser/prefs/pref_change_registrar.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
14 | 14 |
15 class OverlayUserPrefStore; | 15 class OverlayUserPrefStore; |
16 class PrefService; | 16 class PrefService; |
17 class Profile; | 17 class Profile; |
18 struct WebPreferences; | 18 struct WebPreferences; |
19 | 19 |
20 // Per-tab class to handle user preferences. | 20 // Per-tab class to handle user preferences. |
21 class PrefsTabHelper : public content::WebContentsObserver, | 21 class PrefsTabHelper : public content::WebContentsObserver, |
Peter Kasting
2012/03/23 18:19:55
Can this parent class be removed now too? Or do y
falken
2012/03/26 03:39:02
It looks right to remove it. Done.
| |
22 public content::NotificationObserver { | 22 public content::NotificationObserver { |
23 public: | 23 public: |
24 explicit PrefsTabHelper(content::WebContents* contents); | 24 explicit PrefsTabHelper(content::WebContents* contents); |
25 virtual ~PrefsTabHelper(); | 25 virtual ~PrefsTabHelper(); |
26 | 26 |
27 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); | 27 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); |
28 static void InitPerTabUserPrefStore(OverlayUserPrefStore* pref_store); | |
29 static void RegisterUserPrefs(PrefService* prefs); | 28 static void RegisterUserPrefs(PrefService* prefs); |
30 | 29 |
31 PrefService* per_tab_prefs() { return per_tab_prefs_.get(); } | |
32 | |
33 protected: | 30 protected: |
34 // Update the RenderView's WebPreferences. Exposed as protected for testing. | 31 // Update the RenderView's WebPreferences. Exposed as protected for testing. |
35 virtual void UpdateWebPreferences(); | 32 virtual void UpdateWebPreferences(); |
36 | 33 |
37 // content::WebContentsObserver overrides, exposed as protected for testing. | |
38 virtual void RenderViewCreated( | |
39 content::RenderViewHost* render_view_host) OVERRIDE; | |
40 | |
41 private: | 34 private: |
42 // content::WebContentsObserver overrides: | |
43 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; | |
44 | |
45 // content::NotificationObserver overrides: | 35 // content::NotificationObserver overrides: |
46 virtual void Observe(int type, | 36 virtual void Observe(int type, |
47 const content::NotificationSource& source, | 37 const content::NotificationSource& source, |
48 const content::NotificationDetails& details) OVERRIDE; | 38 const content::NotificationDetails& details) OVERRIDE; |
49 | 39 |
50 // Update the TabContents's RendererPreferences. | 40 // Update the TabContents's RendererPreferences. |
51 void UpdateRendererPreferences(); | 41 void UpdateRendererPreferences(); |
52 | 42 |
53 Profile* GetProfile(); | 43 Profile* GetProfile(); |
54 | 44 |
55 content::NotificationRegistrar registrar_; | 45 content::NotificationRegistrar registrar_; |
56 | 46 |
57 scoped_ptr<PrefService> per_tab_prefs_; | |
58 PrefChangeRegistrar pref_change_registrar_; | 47 PrefChangeRegistrar pref_change_registrar_; |
59 PrefChangeRegistrar per_tab_pref_change_registrar_; | |
60 | 48 |
61 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); | 49 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); |
62 }; | 50 }; |
63 | 51 |
64 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ | 52 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ |
OLD | NEW |