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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 private: | 282 private: |
283 DISALLOW_COPY_AND_ASSIGN(ProfileInfo); | 283 DISALLOW_COPY_AND_ASSIGN(ProfileInfo); |
284 }; | 284 }; |
285 | 285 |
286 // Adds a pre-existing Profile object to the set managed by this | 286 // Adds a pre-existing Profile object to the set managed by this |
287 // ProfileManager. This ProfileManager takes ownership of the Profile. | 287 // ProfileManager. This ProfileManager takes ownership of the Profile. |
288 // The Profile should not already be managed by this ProfileManager. | 288 // The Profile should not already be managed by this ProfileManager. |
289 // Returns true if the profile was added, false otherwise. | 289 // Returns true if the profile was added, false otherwise. |
290 bool AddProfile(Profile* profile); | 290 bool AddProfile(Profile* profile); |
291 | 291 |
| 292 // Schedules the profile at the given path to be deleted on shutdown. |
| 293 void FinishDeletingProfile(const base::FilePath& profile_dir); |
| 294 |
| 295 // Returns true if |profile_dir| has been added to ProfilesToDelete. |
| 296 bool IsProfileMarkedForDeletion(const base::FilePath& profile_dir); |
| 297 |
292 // Registers profile with given info. Returns pointer to created ProfileInfo | 298 // Registers profile with given info. Returns pointer to created ProfileInfo |
293 // entry. | 299 // entry. |
294 ProfileInfo* RegisterProfile(Profile* profile, bool created); | 300 ProfileInfo* RegisterProfile(Profile* profile, bool created); |
295 | 301 |
296 // Returns ProfileInfo associated with given |path|, registred earlier with | 302 // Returns ProfileInfo associated with given |path|, registred earlier with |
297 // RegisterProfile. | 303 // RegisterProfile. |
298 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; | 304 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; |
299 | 305 |
300 typedef std::pair<base::FilePath, string16> ProfilePathAndName; | 306 typedef std::pair<base::FilePath, string16> ProfilePathAndName; |
301 typedef std::vector<ProfilePathAndName> ProfilePathAndNames; | 307 typedef std::vector<ProfilePathAndName> ProfilePathAndNames; |
(...skipping 17 matching lines...) Expand all Loading... |
319 // count. | 325 // count. |
320 // Lack of side effects: | 326 // Lack of side effects: |
321 // This function doesn't actually create the directory or touch the file | 327 // This function doesn't actually create the directory or touch the file |
322 // system. | 328 // system. |
323 base::FilePath GenerateNextProfileDirectoryPath(); | 329 base::FilePath GenerateNextProfileDirectoryPath(); |
324 | 330 |
325 void RunCallbacks(const std::vector<CreateCallback>& callbacks, | 331 void RunCallbacks(const std::vector<CreateCallback>& callbacks, |
326 Profile* profile, | 332 Profile* profile, |
327 Profile::CreateStatus status); | 333 Profile::CreateStatus status); |
328 | 334 |
| 335 // If the |loaded_profile| has been loaded succesfully (according to |status|) |
| 336 // and isn't already scheduled for deletion, then finishes adding |
| 337 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates |
| 338 // the kProfileLastUsed preference to |last_non_managed_profile|. |
| 339 void OnNewActiveProfileLoaded( |
| 340 const base::FilePath& profile_to_delete_dir, |
| 341 const base::FilePath& last_non_managed_profile_path, |
| 342 const CreateCallback& original_callback, |
| 343 Profile* loaded_profile, |
| 344 Profile::CreateStatus status); |
| 345 |
329 content::NotificationRegistrar registrar_; | 346 content::NotificationRegistrar registrar_; |
330 | 347 |
331 // The path to the user data directory (DIR_USER_DATA). | 348 // The path to the user data directory (DIR_USER_DATA). |
332 const base::FilePath user_data_dir_; | 349 const base::FilePath user_data_dir_; |
333 | 350 |
334 // Indicates that a user has logged in and that the profile specified | 351 // Indicates that a user has logged in and that the profile specified |
335 // in the --login-profile command line argument should be used as the | 352 // in the --login-profile command line argument should be used as the |
336 // default. | 353 // default. |
337 bool logged_in_; | 354 bool logged_in_; |
338 | 355 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 class ProfileManagerWithoutInit : public ProfileManager { | 404 class ProfileManagerWithoutInit : public ProfileManager { |
388 public: | 405 public: |
389 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 406 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
390 | 407 |
391 protected: | 408 protected: |
392 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 409 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
393 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 410 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
394 }; | 411 }; |
395 | 412 |
396 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 413 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |