Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / prefs / prefs_tab_helper.h
blob07e64cd575d4cbef0b9d6db6493615c557a0d209
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_
8 #include "base/callback_list.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "content/public/browser/web_contents_user_data.h"
16 class OverlayUserPrefStore;
17 class PrefService;
18 class Profile;
20 namespace content {
21 class WebContents;
24 namespace user_prefs {
25 class PrefRegistrySyncable;
28 // Per-tab class to handle user preferences.
29 class PrefsTabHelper : public content::NotificationObserver,
30 public content::WebContentsUserData<PrefsTabHelper> {
31 public:
32 ~PrefsTabHelper() override;
34 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
35 static void GetServiceInstance();
37 protected:
38 // Update the RenderView's WebPreferences. Exposed as protected for testing.
39 virtual void UpdateWebPreferences();
41 private:
42 explicit PrefsTabHelper(content::WebContents* contents);
43 friend class content::WebContentsUserData<PrefsTabHelper>;
44 friend class PrefWatcher;
46 // content::NotificationObserver overrides:
47 void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) override;
51 // Update the WebContents's RendererPreferences.
52 void UpdateRendererPreferences();
54 void OnFontFamilyPrefChanged(const std::string& pref_name);
55 void OnWebPrefChanged(const std::string& pref_name);
57 content::WebContents* web_contents_;
58 Profile* profile_;
59 content::NotificationRegistrar registrar_;
60 scoped_ptr<base::CallbackList<void(void)>::Subscription>
61 style_sheet_subscription_;
62 scoped_ptr<ChromeZoomLevelPrefs::DefaultZoomLevelSubscription>
63 default_zoom_level_subscription_;
64 base::WeakPtrFactory<PrefsTabHelper> weak_ptr_factory_;
66 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper);
69 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_