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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // that at some point the list of numbered profiles is not continuous.) | 145 // that at some point the list of numbered profiles is not continuous.) |
146 static void CreateMultiProfileAsync(); | 146 static void CreateMultiProfileAsync(); |
147 | 147 |
148 // Register multi-profile related preferences in Local State. | 148 // Register multi-profile related preferences in Local State. |
149 static void RegisterPrefs(PrefService* prefs); | 149 static void RegisterPrefs(PrefService* prefs); |
150 | 150 |
151 // Returns a ProfileInfoCache object which can be used to get information | 151 // Returns a ProfileInfoCache object which can be used to get information |
152 // about profiles without having to load them from disk. | 152 // about profiles without having to load them from disk. |
153 ProfileInfoCache& GetProfileInfoCache(); | 153 ProfileInfoCache& GetProfileInfoCache(); |
154 | 154 |
| 155 // Schedules the profile at the given path to be deleted on shutdown. |
| 156 void ScheduleProfileForDeletion(const FilePath& profile_dir); |
| 157 |
155 protected: | 158 protected: |
156 // Does final initial actions. | 159 // Does final initial actions. |
157 virtual void DoFinalInit(Profile* profile); | 160 virtual void DoFinalInit(Profile* profile); |
158 | 161 |
159 private: | 162 private: |
160 friend class ExtensionEventRouterForwarderTest; | 163 friend class ExtensionEventRouterForwarderTest; |
161 | 164 |
162 // This struct contains information about profiles which are being loaded or | 165 // This struct contains information about profiles which are being loaded or |
163 // were loaded. | 166 // were loaded. |
164 struct ProfileInfo { | 167 struct ProfileInfo { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 bool logged_in_; | 211 bool logged_in_; |
209 | 212 |
210 // Maps profile path to ProfileInfo (if profile has been created). Use | 213 // Maps profile path to ProfileInfo (if profile has been created). Use |
211 // RegisterProfile() to add into this map. | 214 // RegisterProfile() to add into this map. |
212 typedef std::map<FilePath, linked_ptr<ProfileInfo> > ProfilesInfoMap; | 215 typedef std::map<FilePath, linked_ptr<ProfileInfo> > ProfilesInfoMap; |
213 ProfilesInfoMap profiles_info_; | 216 ProfilesInfoMap profiles_info_; |
214 | 217 |
215 // Object to cache various information about profiles. | 218 // Object to cache various information about profiles. |
216 scoped_ptr<ProfileInfoCache> profile_info_cache_; | 219 scoped_ptr<ProfileInfoCache> profile_info_cache_; |
217 | 220 |
| 221 // Profiles that should be deleted on shutdown. |
| 222 std::vector<FilePath> profiles_to_delete_; |
| 223 |
218 DISALLOW_COPY_AND_ASSIGN(ProfileManager); | 224 DISALLOW_COPY_AND_ASSIGN(ProfileManager); |
219 }; | 225 }; |
220 | 226 |
221 // Same as the ProfileManager, but doesn't initialize some services of the | 227 // Same as the ProfileManager, but doesn't initialize some services of the |
222 // profile. This one is useful in unittests. | 228 // profile. This one is useful in unittests. |
223 class ProfileManagerWithoutInit : public ProfileManager { | 229 class ProfileManagerWithoutInit : public ProfileManager { |
224 protected: | 230 protected: |
225 virtual void DoFinalInit(Profile*) {} | 231 virtual void DoFinalInit(Profile*) {} |
226 }; | 232 }; |
227 | 233 |
228 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 234 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |