Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/prefs/public/pref_change_registrar.h" 9 #include "base/prefs/public/pref_change_registrar.h"
10 #include "base/prefs/public/pref_observer.h"
10 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
13 14
14 class OverlayUserPrefStore; 15 class OverlayUserPrefStore;
15 class PrefService; 16 class PrefService;
16 class Profile; 17 class Profile;
17 18
18 namespace content { 19 namespace content {
19 class WebContents; 20 class WebContents;
20 } 21 }
21 22
22 // Per-tab class to handle user preferences. 23 // Per-tab class to handle user preferences.
23 class PrefsTabHelper : public content::NotificationObserver, 24 class PrefsTabHelper : public content::NotificationObserver,
25 public PrefObserver,
24 public content::WebContentsUserData<PrefsTabHelper> { 26 public content::WebContentsUserData<PrefsTabHelper> {
25 public: 27 public:
26 virtual ~PrefsTabHelper(); 28 virtual ~PrefsTabHelper();
27 29
28 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); 30 static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store);
29 static void RegisterUserPrefs(PrefService* prefs); 31 static void RegisterUserPrefs(PrefService* prefs);
30 32
31 protected: 33 protected:
32 // Update the RenderView's WebPreferences. Exposed as protected for testing. 34 // Update the RenderView's WebPreferences. Exposed as protected for testing.
33 virtual void UpdateWebPreferences(); 35 virtual void UpdateWebPreferences();
34 36
35 private: 37 private:
36 explicit PrefsTabHelper(content::WebContents* contents); 38 explicit PrefsTabHelper(content::WebContents* contents);
37 friend class content::WebContentsUserData<PrefsTabHelper>; 39 friend class content::WebContentsUserData<PrefsTabHelper>;
38 40
39 // content::NotificationObserver overrides: 41 // content::NotificationObserver overrides:
40 virtual void Observe(int type, 42 virtual void Observe(int type,
41 const content::NotificationSource& source, 43 const content::NotificationSource& source,
42 const content::NotificationDetails& details) OVERRIDE; 44 const content::NotificationDetails& details) OVERRIDE;
43 45
46 // PrefObserver overrides:
47 virtual void OnPreferenceChanged(PrefServiceBase* service,
48 const std::string& pref_name) OVERRIDE;
49
44 // Update the WebContents's RendererPreferences. 50 // Update the WebContents's RendererPreferences.
45 void UpdateRendererPreferences(); 51 void UpdateRendererPreferences();
46 52
47 Profile* GetProfile(); 53 Profile* GetProfile();
48 void OnWebPrefChanged(const std::string& pref_name); 54 void OnWebPrefChanged(const std::string& pref_name);
49 55
50 content::WebContents* web_contents_; 56 content::WebContents* web_contents_;
51 content::NotificationRegistrar registrar_; 57 content::NotificationRegistrar registrar_;
52 PrefChangeRegistrar pref_change_registrar_; 58 PrefChangeRegistrar pref_change_registrar_;
53 59
54 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper); 60 DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper);
55 }; 61 };
56 62
57 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_ 63 #endif // CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698