OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 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 |
| 9 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 10 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" |
| 12 |
| 13 class PrefService; |
| 14 class TabContentsWrapper; |
| 15 struct WebPreferences; |
| 16 |
| 17 // Per-tab class to handle user preferences. |
| 18 class PrefsTabHelper : public TabContentsObserver, |
| 19 public content::NotificationObserver { |
| 20 public: |
| 21 explicit PrefsTabHelper(TabContentsWrapper* tab_contents); |
| 22 virtual ~PrefsTabHelper(); |
| 23 |
| 24 static void RegisterUserPrefs(PrefService* prefs); |
| 25 |
| 26 PrefService* per_tab_prefs() { return per_tab_prefs_.get(); } |
| 27 |
| 28 protected: |
| 29 // Update the RenderView's WebPreferences. Exposed as protected for testing. |
| 30 virtual void UpdateWebPreferences(); |
| 31 |
| 32 // TabContentsObserver overrides, exposed as protected for testing. |
| 33 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
| 34 |
| 35 private: |
| 36 // TabContentsObserver overrides: |
| 37 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; |
| 38 |
| 39 // content::NotificationObserver overrides: |
| 40 virtual void Observe(int type, |
| 41 const content::NotificationSource& source, |
| 42 const content::NotificationDetails& details) OVERRIDE; |
| 43 |
| 44 // Update the TabContents's RendererPreferences. |
| 45 void UpdateRendererPreferences(); |
| 46 |
| 47 // Our owning TabContentsWrapper. |
| 48 TabContentsWrapper* wrapper_; |
| 49 |
| 50 content::NotificationRegistrar registrar_; |
| 51 |
| 52 scoped_ptr<PrefService> per_tab_prefs_; |
| 53 PrefChangeRegistrar pref_change_registrar_; |
| 54 PrefChangeRegistrar per_tab_pref_change_registrar_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); |
| 57 }; |
| 58 |
| 59 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ |
OLD | NEW |