| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 base::FilePath GenerateNextProfileDirectoryPath(); | 159 base::FilePath GenerateNextProfileDirectoryPath(); |
| 160 | 160 |
| 161 // Returns a ProfileInfoCache object which can be used to get information | 161 // Returns a ProfileInfoCache object which can be used to get information |
| 162 // about profiles without having to load them from disk. | 162 // about profiles without having to load them from disk. |
| 163 ProfileInfoCache& GetProfileInfoCache(); | 163 ProfileInfoCache& GetProfileInfoCache(); |
| 164 | 164 |
| 165 // Returns a ProfileShortcut Manager that enables the caller to create | 165 // Returns a ProfileShortcut Manager that enables the caller to create |
| 166 // profile specfic desktop shortcuts. | 166 // profile specfic desktop shortcuts. |
| 167 ProfileShortcutManager* profile_shortcut_manager(); | 167 ProfileShortcutManager* profile_shortcut_manager(); |
| 168 | 168 |
| 169 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 169 // Schedules the profile at the given path to be deleted on shutdown. If we're | 170 // Schedules the profile at the given path to be deleted on shutdown. If we're |
| 170 // deleting the last profile, a new one will be created in its place, and in | 171 // deleting the last profile, a new one will be created in its place, and in |
| 171 // that case the callback will be called when profile creation is complete. | 172 // that case the callback will be called when profile creation is complete. |
| 172 void ScheduleProfileForDeletion(const base::FilePath& profile_dir, | 173 void ScheduleProfileForDeletion(const base::FilePath& profile_dir, |
| 173 const CreateCallback& callback); | 174 const CreateCallback& callback); |
| 175 #endif |
| 174 | 176 |
| 175 // Autoloads profiles if they are running background apps. | 177 // Autoloads profiles if they are running background apps. |
| 176 void AutoloadProfiles(); | 178 void AutoloadProfiles(); |
| 177 | 179 |
| 178 // Checks if any ephemeral profiles are left behind (e.g. because of a browser | 180 // Checks if any ephemeral profiles are left behind (e.g. because of a browser |
| 179 // crash) and schedule them for deletion. | 181 // crash) and schedule them for deletion. |
| 180 void CleanUpEphemeralProfiles(); | 182 void CleanUpEphemeralProfiles(); |
| 181 | 183 |
| 182 // Initializes user prefs of |profile|. This includes profile name and | 184 // Initializes user prefs of |profile|. This includes profile name and |
| 183 // avatar values. | 185 // avatar values. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Adds a pre-existing Profile object to the set managed by this | 260 // Adds a pre-existing Profile object to the set managed by this |
| 259 // ProfileManager. This ProfileManager takes ownership of the Profile. | 261 // ProfileManager. This ProfileManager takes ownership of the Profile. |
| 260 // The Profile should not already be managed by this ProfileManager. | 262 // The Profile should not already be managed by this ProfileManager. |
| 261 // Returns true if the profile was added, false otherwise. | 263 // Returns true if the profile was added, false otherwise. |
| 262 bool AddProfile(Profile* profile); | 264 bool AddProfile(Profile* profile); |
| 263 | 265 |
| 264 // Synchronously creates and returns a profile. This handles both the full | 266 // Synchronously creates and returns a profile. This handles both the full |
| 265 // creation and adds it to the set managed by this ProfileManager. | 267 // creation and adds it to the set managed by this ProfileManager. |
| 266 Profile* CreateAndInitializeProfile(const base::FilePath& profile_dir); | 268 Profile* CreateAndInitializeProfile(const base::FilePath& profile_dir); |
| 267 | 269 |
| 270 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 268 // Schedules the profile at the given path to be deleted on shutdown, | 271 // Schedules the profile at the given path to be deleted on shutdown, |
| 269 // and marks the new profile as active. | 272 // and marks the new profile as active. |
| 270 void FinishDeletingProfile(const base::FilePath& profile_dir, | 273 void FinishDeletingProfile(const base::FilePath& profile_dir, |
| 271 const base::FilePath& new_active_profile_dir); | 274 const base::FilePath& new_active_profile_dir); |
| 275 #endif |
| 272 | 276 |
| 273 // Registers profile with given info. Returns pointer to created ProfileInfo | 277 // Registers profile with given info. Returns pointer to created ProfileInfo |
| 274 // entry. | 278 // entry. |
| 275 ProfileInfo* RegisterProfile(Profile* profile, bool created); | 279 ProfileInfo* RegisterProfile(Profile* profile, bool created); |
| 276 | 280 |
| 277 // Returns ProfileInfo associated with given |path|, registered earlier with | 281 // Returns ProfileInfo associated with given |path|, registered earlier with |
| 278 // RegisterProfile. | 282 // RegisterProfile. |
| 279 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; | 283 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; |
| 280 | 284 |
| 281 // Returns a registered profile. In contrast to GetProfileByPath(), this will | 285 // Returns a registered profile. In contrast to GetProfileByPath(), this will |
| (...skipping 29 matching lines...) Expand all Loading... |
| 311 | 315 |
| 312 // chrome::BrowserListObserver implementation. | 316 // chrome::BrowserListObserver implementation. |
| 313 void OnBrowserAdded(Browser* browser) override; | 317 void OnBrowserAdded(Browser* browser) override; |
| 314 void OnBrowserRemoved(Browser* browser) override; | 318 void OnBrowserRemoved(Browser* browser) override; |
| 315 void OnBrowserSetLastActive(Browser* browser) override; | 319 void OnBrowserSetLastActive(Browser* browser) override; |
| 316 | 320 |
| 317 private: | 321 private: |
| 318 ProfileManager* profile_manager_; | 322 ProfileManager* profile_manager_; |
| 319 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); | 323 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); |
| 320 }; | 324 }; |
| 321 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 322 | 325 |
| 323 // If the |loaded_profile| has been loaded successfully (according to | 326 // If the |loaded_profile| has been loaded successfully (according to |
| 324 // |status|) and isn't already scheduled for deletion, then finishes adding | 327 // |status|) and isn't already scheduled for deletion, then finishes adding |
| 325 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates | 328 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates |
| 326 // the kProfileLastUsed preference based on | 329 // the kProfileLastUsed preference based on |
| 327 // |last_non_supervised_profile_path|. | 330 // |last_non_supervised_profile_path|. |
| 328 void OnNewActiveProfileLoaded( | 331 void OnNewActiveProfileLoaded( |
| 329 const base::FilePath& profile_to_delete_path, | 332 const base::FilePath& profile_to_delete_path, |
| 330 const base::FilePath& last_non_supervised_profile_path, | 333 const base::FilePath& last_non_supervised_profile_path, |
| 331 const CreateCallback& original_callback, | 334 const CreateCallback& original_callback, |
| 332 Profile* loaded_profile, | 335 Profile* loaded_profile, |
| 333 Profile::CreateStatus status); | 336 Profile::CreateStatus status); |
| 337 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 334 | 338 |
| 335 // Object to cache various information about profiles. Contains information | 339 // Object to cache various information about profiles. Contains information |
| 336 // about every profile which has been created for this instance of Chrome, | 340 // about every profile which has been created for this instance of Chrome, |
| 337 // if it has not been explicitly deleted. It must be destroyed after | 341 // if it has not been explicitly deleted. It must be destroyed after |
| 338 // |profiles_info_| because ~ProfileInfo can trigger a chain of events leading | 342 // |profiles_info_| because ~ProfileInfo can trigger a chain of events leading |
| 339 // to an access to this member. | 343 // to an access to this member. |
| 340 scoped_ptr<ProfileInfoCache> profile_info_cache_; | 344 scoped_ptr<ProfileInfoCache> profile_info_cache_; |
| 341 | 345 |
| 342 content::NotificationRegistrar registrar_; | 346 content::NotificationRegistrar registrar_; |
| 343 | 347 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 class ProfileManagerWithoutInit : public ProfileManager { | 381 class ProfileManagerWithoutInit : public ProfileManager { |
| 378 public: | 382 public: |
| 379 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 383 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
| 380 | 384 |
| 381 protected: | 385 protected: |
| 382 void DoFinalInitForServices(Profile*, bool) override {} | 386 void DoFinalInitForServices(Profile*, bool) override {} |
| 383 void DoFinalInitLogging(Profile*) override {} | 387 void DoFinalInitLogging(Profile*) override {} |
| 384 }; | 388 }; |
| 385 | 389 |
| 386 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 390 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |