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

Side by Side Diff: chrome/browser/profiles/profile_impl.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. 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 // This class gathers state related to a single user profile. 5 // This class gathers state related to a single user profile.
6 6
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_
8 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ 8 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/prefs/public/pref_change_registrar.h" 16 #include "base/prefs/public/pref_change_registrar.h"
17 #include "base/timer.h" 17 #include "base/timer.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_impl_io_data.h" 19 #include "chrome/browser/profiles/profile_impl_io_data.h"
20 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
22 22
23 class NetPrefObserver; 23 class NetPrefObserver;
24 class PrefService; 24 class PrefService;
25 class PrefServiceBase;
25 class PromoResourceService; 26 class PromoResourceService;
26 class SSLConfigServiceManager; 27 class SSLConfigServiceManager;
27 28
28 #if defined(OS_CHROMEOS) 29 #if defined(OS_CHROMEOS)
29 namespace chromeos { 30 namespace chromeos {
30 class EnterpriseExtensionObserver; 31 class EnterpriseExtensionObserver;
31 class LocaleChangeGuard; 32 class LocaleChangeGuard;
32 class Preferences; 33 class Preferences;
33 } 34 }
34 #endif 35 #endif
35 36
36 namespace content { 37 namespace content {
37 class SpeechRecognitionPreferences; 38 class SpeechRecognitionPreferences;
38 } 39 }
39 40
40 namespace extensions { 41 namespace extensions {
41 class ExtensionSystem; 42 class ExtensionSystem;
42 } 43 }
43 44
44 // The default profile implementation. 45 // The default profile implementation.
45 class ProfileImpl : public Profile, 46 class ProfileImpl : public Profile,
46 public content::NotificationObserver { 47 public content::NotificationObserver,
48 public PrefObserver {
47 public: 49 public:
48 // Value written to prefs when the exit type is EXIT_NORMAL. Public for tests. 50 // Value written to prefs when the exit type is EXIT_NORMAL. Public for tests.
49 static const char* const kPrefExitTypeNormal; 51 static const char* const kPrefExitTypeNormal;
50 52
51 virtual ~ProfileImpl(); 53 virtual ~ProfileImpl();
52 54
53 static void RegisterUserPrefs(PrefService* prefs); 55 static void RegisterUserPrefs(PrefService* prefs);
54 56
55 // content::BrowserContext implementation: 57 // content::BrowserContext implementation:
56 virtual FilePath GetPath() OVERRIDE; 58 virtual FilePath GetPath() OVERRIDE;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 virtual void InitChromeOSPreferences() OVERRIDE; 121 virtual void InitChromeOSPreferences() OVERRIDE;
120 #endif // defined(OS_CHROMEOS) 122 #endif // defined(OS_CHROMEOS)
121 123
122 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; 124 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE;
123 125
124 // content::NotificationObserver implementation. 126 // content::NotificationObserver implementation.
125 virtual void Observe(int type, 127 virtual void Observe(int type,
126 const content::NotificationSource& source, 128 const content::NotificationSource& source,
127 const content::NotificationDetails& details) OVERRIDE; 129 const content::NotificationDetails& details) OVERRIDE;
128 130
131 // PrefObserver implementation.
132 virtual void OnPreferenceChanged(PrefServiceBase* service,
133 const std::string& pref_name) OVERRIDE;
134
135 // PrefInitObserver implementation.
136
129 private: 137 private:
130 friend class Profile; 138 friend class Profile;
131 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, 139 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
132 ProfilesLaunchedAfterCrash); 140 ProfilesLaunchedAfterCrash);
133 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated); 141 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated);
134 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, 142 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest,
135 ProfileDeletedBeforeReadmeCreated); 143 ProfileDeletedBeforeReadmeCreated);
136 144
137 // Delay, in milliseconds, before README file is created for a new profile. 145 // Delay, in milliseconds, before README file is created for a new profile.
138 // This is non-const for testing purposes. 146 // This is non-const for testing purposes.
139 static int create_readme_delay_ms; 147 static int create_readme_delay_ms;
140 148
141 ProfileImpl(const FilePath& path, 149 ProfileImpl(const FilePath& path,
142 Delegate* delegate, 150 Delegate* delegate,
143 CreateMode create_mode); 151 CreateMode create_mode);
144 152
145 // Does final initialization. Should be called after prefs were loaded. 153 // Does final initialization. Should be called after prefs were loaded.
146 void DoFinalInit(bool is_new_profile); 154 void DoFinalInit(bool is_new_profile);
147 155
148 void InitHostZoomMap(); 156 void InitHostZoomMap();
149 157
158 void OnInitializationCompleted(PrefServiceBase* pref_service,
159 bool succeeded);
160
150 // Does final prefs initialization and calls Init(). 161 // Does final prefs initialization and calls Init().
151 void OnPrefsLoaded(bool success); 162 void OnPrefsLoaded(bool success);
152 163
153 FilePath GetPrefFilePath(); 164 FilePath GetPrefFilePath();
154 165
155 #if defined(ENABLE_SESSION_SERVICE) 166 #if defined(ENABLE_SESSION_SERVICE)
156 void StopCreateSessionServiceTimer(); 167 void StopCreateSessionServiceTimer();
157 168
158 void EnsureSessionServiceCreated(); 169 void EnsureSessionServiceCreated();
159 #endif 170 #endif
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // chrome/browser/profile/profile_keyed_dependency_manager.{h,cc} 267 // chrome/browser/profile/profile_keyed_dependency_manager.{h,cc}
257 268
258 Profile::Delegate* delegate_; 269 Profile::Delegate* delegate_;
259 270
260 chrome_browser_net::Predictor* predictor_; 271 chrome_browser_net::Predictor* predictor_;
261 272
262 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); 273 DISALLOW_COPY_AND_ASSIGN(ProfileImpl);
263 }; 274 };
264 275
265 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ 276 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698