| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // NotificationObserver implementation. | 119 // NotificationObserver implementation. |
| 120 virtual void Observe(int type, | 120 virtual void Observe(int type, |
| 121 const NotificationSource& source, | 121 const NotificationSource& source, |
| 122 const NotificationDetails& details); | 122 const NotificationDetails& details); |
| 123 | 123 |
| 124 // BrowserList::Observer implementation. | 124 // BrowserList::Observer implementation. |
| 125 virtual void OnBrowserAdded(const Browser* browser); | 125 virtual void OnBrowserAdded(const Browser* browser); |
| 126 virtual void OnBrowserRemoved(const Browser* browser); | 126 virtual void OnBrowserRemoved(const Browser* browser); |
| 127 virtual void OnBrowserSetLastActive(const Browser* browser); | 127 virtual void OnBrowserSetLastActive(const Browser* browser); |
| 128 | 128 |
| 129 // Set the flag indicating whether an import process will be run. If |
| 130 // |will_import| is false, notify the NotificationService that |profile| has |
| 131 // finished its import process. If |will_import| is false, |profile| is |
| 132 // required to be non-NULL. |
| 133 void SetWillImport(bool will_import, Profile* profile); |
| 134 bool will_import() { return will_import_; } |
| 135 |
| 129 // ------------------ static utility functions ------------------- | 136 // ------------------ static utility functions ------------------- |
| 130 | 137 |
| 131 // Returns the path to the default profile directory, based on the given | 138 // Returns the path to the default profile directory, based on the given |
| 132 // user data directory. | 139 // user data directory. |
| 133 static FilePath GetDefaultProfileDir(const FilePath& user_data_dir); | 140 static FilePath GetDefaultProfileDir(const FilePath& user_data_dir); |
| 134 | 141 |
| 135 // Returns the path to the preferences file given the user profile directory. | 142 // Returns the path to the preferences file given the user profile directory. |
| 136 static FilePath GetProfilePrefsPath(const FilePath& profile_dir); | 143 static FilePath GetProfilePrefsPath(const FilePath& profile_dir); |
| 137 | 144 |
| 138 // If a profile with the given path is currently managed by this object, | 145 // If a profile with the given path is currently managed by this object, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // For ChromeOS, determines if profile should be otr. | 225 // For ChromeOS, determines if profile should be otr. |
| 219 bool ShouldGoOffTheRecord(); | 226 bool ShouldGoOffTheRecord(); |
| 220 | 227 |
| 221 NotificationRegistrar registrar_; | 228 NotificationRegistrar registrar_; |
| 222 | 229 |
| 223 // Indicates that a user has logged in and that the profile specified | 230 // Indicates that a user has logged in and that the profile specified |
| 224 // in the --login-profile command line argument should be used as the | 231 // in the --login-profile command line argument should be used as the |
| 225 // default. | 232 // default. |
| 226 bool logged_in_; | 233 bool logged_in_; |
| 227 | 234 |
| 235 // True if an import process will be run. |
| 236 bool will_import_; |
| 237 |
| 228 // Maps profile path to ProfileInfo (if profile has been created). Use | 238 // Maps profile path to ProfileInfo (if profile has been created). Use |
| 229 // RegisterProfile() to add into this map. | 239 // RegisterProfile() to add into this map. |
| 230 typedef std::map<FilePath, linked_ptr<ProfileInfo> > ProfilesInfoMap; | 240 typedef std::map<FilePath, linked_ptr<ProfileInfo> > ProfilesInfoMap; |
| 231 ProfilesInfoMap profiles_info_; | 241 ProfilesInfoMap profiles_info_; |
| 232 | 242 |
| 233 // Object to cache various information about profiles. | 243 // Object to cache various information about profiles. |
| 234 scoped_ptr<ProfileInfoCache> profile_info_cache_; | 244 scoped_ptr<ProfileInfoCache> profile_info_cache_; |
| 235 | 245 |
| 236 // Profiles that should be deleted on shutdown. | 246 // Profiles that should be deleted on shutdown. |
| 237 std::vector<FilePath> profiles_to_delete_; | 247 std::vector<FilePath> profiles_to_delete_; |
| 238 | 248 |
| 239 DISALLOW_COPY_AND_ASSIGN(ProfileManager); | 249 DISALLOW_COPY_AND_ASSIGN(ProfileManager); |
| 240 }; | 250 }; |
| 241 | 251 |
| 242 // Same as the ProfileManager, but doesn't initialize some services of the | 252 // Same as the ProfileManager, but doesn't initialize some services of the |
| 243 // profile. This one is useful in unittests. | 253 // profile. This one is useful in unittests. |
| 244 class ProfileManagerWithoutInit : public ProfileManager { | 254 class ProfileManagerWithoutInit : public ProfileManager { |
| 245 protected: | 255 protected: |
| 246 virtual void DoFinalInit(Profile*, bool) {} | 256 virtual void DoFinalInit(Profile*, bool) {} |
| 247 }; | 257 }; |
| 248 | 258 |
| 249 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 259 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |