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 | |
140 // PrefInitObserver implementation. | |
Mattias Nissler (ping if slow)
2012/10/31 13:29:36
Comment misplaced :)
Jói
2012/10/31 14:56:26
Done.
| |
141 | |
134 private: | 142 private: |
135 friend class Profile; | 143 friend class Profile; |
136 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, | 144 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, |
137 ProfilesLaunchedAfterCrash); | 145 ProfilesLaunchedAfterCrash); |
138 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated); | 146 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated); |
139 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, | 147 FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, |
140 ProfileDeletedBeforeReadmeCreated); | 148 ProfileDeletedBeforeReadmeCreated); |
141 | 149 |
142 // Delay, in milliseconds, before README file is created for a new profile. | 150 // Delay, in milliseconds, before README file is created for a new profile. |
143 // This is non-const for testing purposes. | 151 // This is non-const for testing purposes. |
144 static int create_readme_delay_ms; | 152 static int create_readme_delay_ms; |
145 | 153 |
146 ProfileImpl(const FilePath& path, | 154 ProfileImpl(const FilePath& path, |
147 Delegate* delegate, | 155 Delegate* delegate, |
148 CreateMode create_mode, | 156 CreateMode create_mode, |
149 base::SequencedTaskRunner* sequenced_task_runner); | 157 base::SequencedTaskRunner* sequenced_task_runner); |
150 | 158 |
151 // Does final initialization. Should be called after prefs were loaded. | 159 // Does final initialization. Should be called after prefs were loaded. |
152 void DoFinalInit(bool is_new_profile); | 160 void DoFinalInit(bool is_new_profile); |
153 | 161 |
154 void InitHostZoomMap(); | 162 void InitHostZoomMap(); |
155 | 163 |
164 void OnInitializationCompleted(PrefServiceBase* pref_service, | |
165 bool succeeded); | |
166 | |
156 // Does final prefs initialization and calls Init(). | 167 // Does final prefs initialization and calls Init(). |
157 void OnPrefsLoaded(bool success); | 168 void OnPrefsLoaded(bool success); |
158 | 169 |
159 FilePath GetPrefFilePath(); | 170 FilePath GetPrefFilePath(); |
160 | 171 |
161 #if defined(ENABLE_SESSION_SERVICE) | 172 #if defined(ENABLE_SESSION_SERVICE) |
162 void StopCreateSessionServiceTimer(); | 173 void StopCreateSessionServiceTimer(); |
163 | 174 |
164 void EnsureSessionServiceCreated(); | 175 void EnsureSessionServiceCreated(); |
165 #endif | 176 #endif |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 // chrome/browser/profile/profile_keyed_dependency_manager.{h,cc} | 273 // chrome/browser/profile/profile_keyed_dependency_manager.{h,cc} |
263 | 274 |
264 Profile::Delegate* delegate_; | 275 Profile::Delegate* delegate_; |
265 | 276 |
266 chrome_browser_net::Predictor* predictor_; | 277 chrome_browser_net::Predictor* predictor_; |
267 | 278 |
268 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 279 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
269 }; | 280 }; |
270 | 281 |
271 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 282 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
OLD | NEW |