| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Adds a pre-existing Profile object to the set managed by this | 258 // Adds a pre-existing Profile object to the set managed by this |
| 259 // ProfileManager. This ProfileManager takes ownership of the Profile. | 259 // ProfileManager. This ProfileManager takes ownership of the Profile. |
| 260 // The Profile should not already be managed by this ProfileManager. | 260 // The Profile should not already be managed by this ProfileManager. |
| 261 // Returns true if the profile was added, false otherwise. | 261 // Returns true if the profile was added, false otherwise. |
| 262 bool AddProfile(Profile* profile); | 262 bool AddProfile(Profile* profile); |
| 263 | 263 |
| 264 // Synchronously creates and returns a profile. This handles both the full | 264 // Synchronously creates and returns a profile. This handles both the full |
| 265 // creation and adds it to the set managed by this ProfileManager. | 265 // creation and adds it to the set managed by this ProfileManager. |
| 266 Profile* CreateAndInitializeProfile(const base::FilePath& profile_dir); | 266 Profile* CreateAndInitializeProfile(const base::FilePath& profile_dir); |
| 267 | 267 |
| 268 // Schedules the profile at the given path to be deleted on shutdown. | 268 // Schedules the profile at the given path to be deleted on shutdown, |
| 269 void FinishDeletingProfile(const base::FilePath& profile_dir); | 269 // and marks the new profile as active. |
| 270 void FinishDeletingProfile(const base::FilePath& profile_dir, |
| 271 const base::FilePath& new_active_profile_dir); |
| 270 | 272 |
| 271 // Registers profile with given info. Returns pointer to created ProfileInfo | 273 // Registers profile with given info. Returns pointer to created ProfileInfo |
| 272 // entry. | 274 // entry. |
| 273 ProfileInfo* RegisterProfile(Profile* profile, bool created); | 275 ProfileInfo* RegisterProfile(Profile* profile, bool created); |
| 274 | 276 |
| 275 // Returns ProfileInfo associated with given |path|, registered earlier with | 277 // Returns ProfileInfo associated with given |path|, registered earlier with |
| 276 // RegisterProfile. | 278 // RegisterProfile. |
| 277 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; | 279 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; |
| 278 | 280 |
| 279 // Returns a registered profile. In contrast to GetProfileByPath(), this will | 281 // Returns a registered profile. In contrast to GetProfileByPath(), this will |
| (...skipping 30 matching lines...) Expand all Loading... |
| 310 void OnBrowserAdded(Browser* browser) override; | 312 void OnBrowserAdded(Browser* browser) override; |
| 311 void OnBrowserRemoved(Browser* browser) override; | 313 void OnBrowserRemoved(Browser* browser) override; |
| 312 void OnBrowserSetLastActive(Browser* browser) override; | 314 void OnBrowserSetLastActive(Browser* browser) override; |
| 313 | 315 |
| 314 private: | 316 private: |
| 315 ProfileManager* profile_manager_; | 317 ProfileManager* profile_manager_; |
| 316 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); | 318 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); |
| 317 }; | 319 }; |
| 318 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 320 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 319 | 321 |
| 320 #if defined(OS_MACOSX) | |
| 321 // If the |loaded_profile| has been loaded successfully (according to | 322 // If the |loaded_profile| has been loaded successfully (according to |
| 322 // |status|) and isn't already scheduled for deletion, then finishes adding | 323 // |status|) and isn't already scheduled for deletion, then finishes adding |
| 323 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates | 324 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates |
| 324 // the kProfileLastUsed preference based on | 325 // the kProfileLastUsed preference based on |
| 325 // |last_non_supervised_profile_path|. | 326 // |last_non_supervised_profile_path|. |
| 326 void OnNewActiveProfileLoaded( | 327 void OnNewActiveProfileLoaded( |
| 327 const base::FilePath& profile_to_delete_path, | 328 const base::FilePath& profile_to_delete_path, |
| 328 const base::FilePath& last_non_supervised_profile_path, | 329 const base::FilePath& last_non_supervised_profile_path, |
| 329 const CreateCallback& original_callback, | 330 const CreateCallback& original_callback, |
| 330 Profile* loaded_profile, | 331 Profile* loaded_profile, |
| 331 Profile::CreateStatus status); | 332 Profile::CreateStatus status); |
| 332 #endif | |
| 333 | 333 |
| 334 content::NotificationRegistrar registrar_; | 334 content::NotificationRegistrar registrar_; |
| 335 | 335 |
| 336 // The path to the user data directory (DIR_USER_DATA). | 336 // The path to the user data directory (DIR_USER_DATA). |
| 337 const base::FilePath user_data_dir_; | 337 const base::FilePath user_data_dir_; |
| 338 | 338 |
| 339 // Indicates that a user has logged in and that the profile specified | 339 // Indicates that a user has logged in and that the profile specified |
| 340 // in the --login-profile command line argument should be used as the | 340 // in the --login-profile command line argument should be used as the |
| 341 // default. | 341 // default. |
| 342 bool logged_in_; | 342 bool logged_in_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 class ProfileManagerWithoutInit : public ProfileManager { | 374 class ProfileManagerWithoutInit : public ProfileManager { |
| 375 public: | 375 public: |
| 376 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 376 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
| 377 | 377 |
| 378 protected: | 378 protected: |
| 379 void DoFinalInitForServices(Profile*, bool) override {} | 379 void DoFinalInitForServices(Profile*, bool) override {} |
| 380 void DoFinalInitLogging(Profile*) override {} | 380 void DoFinalInitLogging(Profile*) override {} |
| 381 }; | 381 }; |
| 382 | 382 |
| 383 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 383 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |