OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 keeps track of the currently-active profiles in the runtime. | 5 // This class keeps track of the currently-active profiles in the runtime. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
8 #define CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 8 #define CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "content/common/notification_observer.h" | 23 #include "content/common/notification_observer.h" |
24 #include "content/common/notification_registrar.h" | 24 #include "content/common/notification_registrar.h" |
25 | 25 |
26 class FilePath; | 26 class FilePath; |
27 class NewProfileLauncher; | 27 class NewProfileLauncher; |
28 class ProfileInfoCache; | 28 class ProfileInfoCache; |
29 | 29 |
30 class ProfileManagerObserver { | 30 class ProfileManagerObserver { |
31 public: | 31 public: |
32 enum Status { | 32 enum Status { |
33 // So epic. | 33 // Profile creation has failed. |
34 STATUS_FAIL, | 34 STATUS_FAIL, |
35 // Profile created but before initializing extensions and promo resources. | 35 // Profile created but before initializing extensions and promo resources. |
36 STATUS_CREATED, | 36 STATUS_CREATED, |
37 // Profile is created, extensions and promo resources are initialized. | 37 // Profile is created, extensions and promo resources are initialized. |
38 STATUS_INITIALIZED | 38 STATUS_INITIALIZED |
39 }; | 39 }; |
40 | 40 |
41 // This method is called when profile is ready. If profile already exists, | 41 // This method is called when profile is ready. If profile already exists, |
42 // method is called with pointer to that profile and STATUS_INITIALIZED. | 42 // method is called with pointer to that profile and STATUS_INITIALIZED. |
43 // If profile creation has failed, method is called with |profile| equal to | 43 // If profile creation has failed, method is called with |profile| equal to |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // Returns a ProfileInfoCache object which can be used to get information | 160 // Returns a ProfileInfoCache object which can be used to get information |
161 // about profiles without having to load them from disk. | 161 // about profiles without having to load them from disk. |
162 ProfileInfoCache& GetProfileInfoCache(); | 162 ProfileInfoCache& GetProfileInfoCache(); |
163 | 163 |
164 // Schedules the profile at the given path to be deleted on shutdown. | 164 // Schedules the profile at the given path to be deleted on shutdown. |
165 void ScheduleProfileForDeletion(const FilePath& profile_dir); | 165 void ScheduleProfileForDeletion(const FilePath& profile_dir); |
166 | 166 |
167 // Checks if multiple profiles is enabled. | 167 // Checks if multiple profiles is enabled. |
168 static bool IsMultipleProfilesEnabled(); | 168 static bool IsMultipleProfilesEnabled(); |
169 | 169 |
| 170 // Register and add testing profile to the ProfileManager. Use ONLY in tests! |
| 171 // This allows the creation of Profiles outside of the standard creation path |
| 172 // for testing only. If |addToCache|, add to ProfileInfoCache as well. |
| 173 void RegisterTestingProfile(Profile* profile, bool addToCache); |
| 174 |
170 protected: | 175 protected: |
171 // Does final initial actions. | 176 // Does final initial actions. |
172 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); | 177 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); |
173 | 178 |
174 private: | 179 private: |
175 friend class ExtensionEventRouterForwarderTest; | |
176 | |
177 // This struct contains information about profiles which are being loaded or | 180 // This struct contains information about profiles which are being loaded or |
178 // were loaded. | 181 // were loaded. |
179 struct ProfileInfo { | 182 struct ProfileInfo { |
180 ProfileInfo(Profile* profile, bool created) | 183 ProfileInfo(Profile* profile, bool created) |
181 : profile(profile), created(created) { | 184 : profile(profile), created(created) { |
182 } | 185 } |
183 | 186 |
184 ~ProfileInfo() {} | 187 ~ProfileInfo() {} |
185 | 188 |
186 scoped_ptr<Profile> profile; | 189 scoped_ptr<Profile> profile; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 }; | 243 }; |
241 | 244 |
242 // Same as the ProfileManager, but doesn't initialize some services of the | 245 // Same as the ProfileManager, but doesn't initialize some services of the |
243 // profile. This one is useful in unittests. | 246 // profile. This one is useful in unittests. |
244 class ProfileManagerWithoutInit : public ProfileManager { | 247 class ProfileManagerWithoutInit : public ProfileManager { |
245 protected: | 248 protected: |
246 virtual void DoFinalInit(Profile*, bool) {} | 249 virtual void DoFinalInit(Profile*, bool) {} |
247 }; | 250 }; |
248 | 251 |
249 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 252 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |