[email protected] | 32c3c75 | 2012-01-05 17:33:47 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ | ||||
6 | #define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ | ||||
7 | #pragma once | ||||
8 | |||||
[email protected] | 71fde35 | 2011-12-29 03:29:56 | [diff] [blame] | 9 | #include "base/memory/scoped_ptr.h" |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 10 | #include "chrome/browser/prefs/pref_change_registrar.h" |
[email protected] | 71fde35 | 2011-12-29 03:29:56 | [diff] [blame] | 11 | #include "content/public/browser/notification_observer.h" |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 12 | #include "content/public/browser/notification_registrar.h" |
13 | |||||
[email protected] | 32c3c75 | 2012-01-05 17:33:47 | [diff] [blame] | 14 | class OverlayUserPrefStore; |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 15 | class PrefService; |
[email protected] | ea6ad01a | 2011-12-21 21:53:49 | [diff] [blame] | 16 | class Profile; |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 17 | struct WebPreferences; |
18 | |||||
[email protected] | d0aa78d | 2012-03-26 07:55:02 | [diff] [blame^] | 19 | namespace content { |
20 | class WebContents; | ||||
21 | } | ||||
22 | |||||
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 23 | // Per-tab class to handle user preferences. |
[email protected] | d0aa78d | 2012-03-26 07:55:02 | [diff] [blame^] | 24 | class PrefsTabHelper : public content::NotificationObserver { |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 25 | public: |
[email protected] | 768c547 | 2011-12-26 19:06:17 | [diff] [blame] | 26 | explicit PrefsTabHelper(content::WebContents* contents); |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 27 | virtual ~PrefsTabHelper(); |
28 | |||||
[email protected] | 32c3c75 | 2012-01-05 17:33:47 | [diff] [blame] | 29 | static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 30 | static void RegisterUserPrefs(PrefService* prefs); |
31 | |||||
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 32 | protected: |
33 | // Update the RenderView's WebPreferences. Exposed as protected for testing. | ||||
34 | virtual void UpdateWebPreferences(); | ||||
35 | |||||
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 36 | private: |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 37 | // content::NotificationObserver overrides: |
38 | virtual void Observe(int type, | ||||
39 | const content::NotificationSource& source, | ||||
40 | const content::NotificationDetails& details) OVERRIDE; | ||||
41 | |||||
42 | // Update the TabContents's RendererPreferences. | ||||
43 | void UpdateRendererPreferences(); | ||||
44 | |||||
[email protected] | ea6ad01a | 2011-12-21 21:53:49 | [diff] [blame] | 45 | Profile* GetProfile(); |
46 | |||||
[email protected] | d0aa78d | 2012-03-26 07:55:02 | [diff] [blame^] | 47 | content::WebContents* web_contents_; |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 48 | content::NotificationRegistrar registrar_; |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 49 | PrefChangeRegistrar pref_change_registrar_; |
[email protected] | 9ce7cb4 | 2011-12-07 18:53:07 | [diff] [blame] | 50 | |
51 | DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); | ||||
52 | }; | ||||
53 | |||||
54 | #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ |