Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / ui / prefs / prefs_tab_helper.h
blob502e217c89f63fe6fe88d277a5281fb87a11a81c
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 "base/prefs/pref_change_registrar.h"
12 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/web_contents_user_data.h"
17 class OverlayUserPrefStore;
18 class PrefService;
19 class Profile;
21 namespace content {
22 class WebContents;
25 namespace user_prefs {
26 class PrefRegistrySyncable;
29 // Per-tab class to handle user preferences.
30 class PrefsTabHelper : public content::NotificationObserver,
31 public content::WebContentsUserData<PrefsTabHelper> {
32 public:
33 virtual ~PrefsTabHelper();
35 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store);
36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
38 protected:
39 // Update the RenderView's WebPreferences. Exposed as protected for testing.
40 virtual void UpdateWebPreferences();
42 private:
43 explicit PrefsTabHelper(content::WebContents* contents);
44 friend class content::WebContentsUserData<PrefsTabHelper>;
46 // content::NotificationObserver overrides:
47 virtual 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 Profile* GetProfile();
56 void OnFontFamilyPrefChanged(const std::string& pref_name);
57 void OnWebPrefChanged(const std::string& pref_name);
59 content::WebContents* web_contents_;
60 content::NotificationRegistrar registrar_;
61 PrefChangeRegistrar pref_change_registrar_;
62 scoped_ptr<base::CallbackList<void(void)>::Subscription>
63 style_sheet_subscription_;
64 scoped_ptr<chrome::ChromeZoomLevelPrefs::DefaultZoomLevelSubscription>
65 default_zoom_level_subscription_;
66 base::WeakPtrFactory<PrefsTabHelper> weak_ptr_factory_;
68 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper);
71 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_