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 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 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 // profile specfic desktop shortcuts. | 195 // profile specfic desktop shortcuts. |
196 ProfileShortcutManager* profile_shortcut_manager(); | 196 ProfileShortcutManager* profile_shortcut_manager(); |
197 | 197 |
198 // Schedules the profile at the given path to be deleted on shutdown. | 198 // Schedules the profile at the given path to be deleted on shutdown. |
199 void ScheduleProfileForDeletion(const FilePath& profile_dir, | 199 void ScheduleProfileForDeletion(const FilePath& profile_dir, |
200 chrome::HostDesktopType desktop_type); | 200 chrome::HostDesktopType desktop_type); |
201 | 201 |
202 // Checks if multiple profiles is enabled. | 202 // Checks if multiple profiles is enabled. |
203 static bool IsMultipleProfilesEnabled(); | 203 static bool IsMultipleProfilesEnabled(); |
204 | 204 |
205 // Force IsMultipleProfilesEnabled to return a given value. For testing | |
206 // purposes. | |
207 static void ForceMultipleProfilesForTests(bool forcedValue); | |
208 | |
209 // Lets IsMultipleProfilesEnabled behave in a normal, unforced way. | |
210 static void UnforceMultipleProfilesForTests(); | |
211 | |
205 // Autoloads profiles if they are running background apps. | 212 // Autoloads profiles if they are running background apps. |
206 void AutoloadProfiles(); | 213 void AutoloadProfiles(); |
207 | 214 |
208 // Register and add testing profile to the ProfileManager. Use ONLY in tests. | 215 // Register and add testing profile to the ProfileManager. Use ONLY in tests. |
209 // This allows the creation of Profiles outside of the standard creation path | 216 // This allows the creation of Profiles outside of the standard creation path |
210 // for testing. If |addToCache|, add to ProfileInfoCache as well. | 217 // for testing. If |addToCache|, add to ProfileInfoCache as well. |
211 void RegisterTestingProfile(Profile* profile, bool addToCache); | 218 void RegisterTestingProfile(Profile* profile, bool addToCache); |
212 | 219 |
213 const FilePath& user_data_dir() const { return user_data_dir_; } | 220 const FilePath& user_data_dir() const { return user_data_dir_; } |
214 | 221 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 BrowserListObserver browser_list_observer_; | 349 BrowserListObserver browser_list_observer_; |
343 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 350 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
344 | 351 |
345 // For keeping track of the last active profiles. | 352 // For keeping track of the last active profiles. |
346 std::map<Profile*, int> browser_counts_; | 353 std::map<Profile*, int> browser_counts_; |
347 // On startup we launch the active profiles in the order they became active | 354 // On startup we launch the active profiles in the order they became active |
348 // during the last run. This is why they are kept in a list, not in a set. | 355 // during the last run. This is why they are kept in a list, not in a set. |
349 std::vector<Profile*> active_profiles_; | 356 std::vector<Profile*> active_profiles_; |
350 bool closing_all_browsers_; | 357 bool closing_all_browsers_; |
351 | 358 |
359 // For forcing IsMultiProfilesEnabled to the value of | |
360 // multiple_profiles_forced_value_. Used for testing. | |
361 static bool is_multiple_profiles_forced_; | |
sail
2013/01/31 17:15:23
maybe use an enum instead of 2 bools, something li
jwd
2013/01/31 19:26:11
Done. Kept the api the same though.
| |
362 | |
363 // The value returned by IsMultiProfilesEnabled when it's been forced. Used | |
364 // for testing. | |
365 static bool multiple_profiles_forced_value_; | |
366 | |
352 DISALLOW_COPY_AND_ASSIGN(ProfileManager); | 367 DISALLOW_COPY_AND_ASSIGN(ProfileManager); |
353 }; | 368 }; |
354 | 369 |
355 // Same as the ProfileManager, but doesn't initialize some services of the | 370 // Same as the ProfileManager, but doesn't initialize some services of the |
356 // profile. This one is useful in unittests. | 371 // profile. This one is useful in unittests. |
357 class ProfileManagerWithoutInit : public ProfileManager { | 372 class ProfileManagerWithoutInit : public ProfileManager { |
358 public: | 373 public: |
359 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); | 374 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); |
360 | 375 |
361 protected: | 376 protected: |
362 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 377 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
363 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 378 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
364 }; | 379 }; |
365 | 380 |
366 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 381 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |