OLD | NEW |
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 base { | 37 namespace base { |
37 class SequencedTaskRunner; | 38 class SequencedTaskRunner; |
38 } | 39 } |
39 | 40 |
40 namespace content { | 41 namespace content { |
41 class SpeechRecognitionPreferences; | 42 class SpeechRecognitionPreferences; |
42 } | 43 } |
43 | 44 |
44 namespace extensions { | 45 namespace extensions { |
45 class ExtensionSystem; | 46 class ExtensionSystem; |
46 } | 47 } |
47 | 48 |
48 // The default profile implementation. | 49 // The default profile implementation. |
49 class ProfileImpl : public Profile, | 50 class ProfileImpl : public Profile, |
50 public content::NotificationObserver { | 51 public content::NotificationObserver, |
| 52 public PrefObserver { |
51 public: | 53 public: |
52 // Value written to prefs when the exit type is EXIT_NORMAL. Public for tests. | 54 // Value written to prefs when the exit type is EXIT_NORMAL. Public for tests. |
53 static const char* const kPrefExitTypeNormal; | 55 static const char* const kPrefExitTypeNormal; |
54 | 56 |
55 virtual ~ProfileImpl(); | 57 virtual ~ProfileImpl(); |
56 | 58 |
57 static void RegisterUserPrefs(PrefService* prefs); | 59 static void RegisterUserPrefs(PrefService* prefs); |
58 | 60 |
59 // content::BrowserContext implementation: | 61 // content::BrowserContext implementation: |
60 virtual FilePath GetPath() OVERRIDE; | 62 virtual FilePath GetPath() OVERRIDE; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 virtual void InitChromeOSPreferences() OVERRIDE; | 126 virtual void InitChromeOSPreferences() OVERRIDE; |
125 #endif // defined(OS_CHROMEOS) | 127 #endif // defined(OS_CHROMEOS) |
126 | 128 |
127 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; | 129 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; |
128 | 130 |
129 // content::NotificationObserver implementation. | 131 // content::NotificationObserver implementation. |
130 virtual void Observe(int type, | 132 virtual void Observe(int type, |
131 const content::NotificationSource& source, | 133 const content::NotificationSource& source, |
132 const content::NotificationDetails& details) OVERRIDE; | 134 const content::NotificationDetails& details) OVERRIDE; |
133 | 135 |
| 136 // PrefObserver implementation. |
| 137 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 138 const std::string& pref_name) OVERRIDE; |
| 139 |
134 private: | 140 private: |
135 friend class Profile; | 141 friend class Profile; |
136 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, | 142 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, |
137 ProfilesLaunchedAfterCrash); | 143 ProfilesLaunchedAfterCrash); |
138 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated); | 144 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated); |
139 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, | 145 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, |
140 ProfileDeletedBeforeReadmeCreated); | 146 ProfileDeletedBeforeReadmeCreated); |
141 | 147 |
142 // Delay, in milliseconds, before README file is created for a new profile. | 148 // Delay, in milliseconds, before README file is created for a new profile. |
143 // This is non-const for testing purposes. | 149 // This is non-const for testing purposes. |
144 static int create_readme_delay_ms; | 150 static int create_readme_delay_ms; |
145 | 151 |
146 ProfileImpl(const FilePath& path, | 152 ProfileImpl(const FilePath& path, |
147 Delegate* delegate, | 153 Delegate* delegate, |
148 CreateMode create_mode, | 154 CreateMode create_mode, |
149 base::SequencedTaskRunner* sequenced_task_runner); | 155 base::SequencedTaskRunner* sequenced_task_runner); |
150 | 156 |
151 // Does final initialization. Should be called after prefs were loaded. | 157 // Does final initialization. Should be called after prefs were loaded. |
152 void DoFinalInit(bool is_new_profile); | 158 void DoFinalInit(bool is_new_profile); |
153 | 159 |
154 void InitHostZoomMap(); | 160 void InitHostZoomMap(); |
155 | 161 |
| 162 void OnInitializationCompleted(PrefServiceBase* pref_service, |
| 163 bool succeeded); |
| 164 |
156 // Does final prefs initialization and calls Init(). | 165 // Does final prefs initialization and calls Init(). |
157 void OnPrefsLoaded(bool success); | 166 void OnPrefsLoaded(bool success); |
158 | 167 |
159 FilePath GetPrefFilePath(); | 168 FilePath GetPrefFilePath(); |
160 | 169 |
161 #if defined(ENABLE_SESSION_SERVICE) | 170 #if defined(ENABLE_SESSION_SERVICE) |
162 void StopCreateSessionServiceTimer(); | 171 void StopCreateSessionServiceTimer(); |
163 | 172 |
164 void EnsureSessionServiceCreated(); | 173 void EnsureSessionServiceCreated(); |
165 #endif | 174 #endif |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // chrome/browser/profile/profile_keyed_dependency_manager.{h,cc} | 271 // chrome/browser/profile/profile_keyed_dependency_manager.{h,cc} |
263 | 272 |
264 Profile::Delegate* delegate_; | 273 Profile::Delegate* delegate_; |
265 | 274 |
266 chrome_browser_net::Predictor* predictor_; | 275 chrome_browser_net::Predictor* predictor_; |
267 | 276 |
268 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 277 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
269 }; | 278 }; |
270 | 279 |
271 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 280 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
OLD | NEW |