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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // TODO(skuhne): Move into ash's new user management function. | 54 // TODO(skuhne): Move into ash's new user management function. |
55 | 55 |
56 // Get the profile for the user which created the current session. | 56 // Get the profile for the user which created the current session. |
57 // Note that in case of a guest account this will return a 'suitable' profile. | 57 // Note that in case of a guest account this will return a 'suitable' profile. |
58 static Profile* GetPrimaryUserProfile(); | 58 static Profile* GetPrimaryUserProfile(); |
59 | 59 |
60 // Get the profile for the currently active user. | 60 // Get the profile for the currently active user. |
61 // Note that in case of a guest account this will return a 'suitable' profile. | 61 // Note that in case of a guest account this will return a 'suitable' profile. |
62 static Profile* GetActiveUserProfile(); | 62 static Profile* GetActiveUserProfile(); |
63 | 63 |
64 // The following DEPRECATED functions should be removed: crbug.com/83792. | 64 // DEPRECATED: DO NOT USE. Function will be removed soon (crbug.com/322682). |
65 | 65 // Use GetPrimaryUserProfile or GetActiveUserProfile instead. |
66 // DEPRECATED: DO NOT USE unless in ChromeOS. | 66 // Returns the default profile. This adds the profile to the |
67 // Returns the default profile. This adds the profile to the | 67 // ProfileManager if it doesn't already exist. This method returns NULL if |
68 // ProfileManager if it doesn't already exist. This method returns NULL if | |
69 // the profile doesn't exist and we can't create it. | 68 // the profile doesn't exist and we can't create it. |
70 // The profile used can be overridden by using --login-profile on cros. | 69 // The profile used can be overridden by using --login-profile on cros. |
71 Profile* GetDefaultProfile(const base::FilePath& user_data_dir); | |
72 | |
73 // DEPRECATED: DO NOT USE unless in ChromeOS. | |
74 // Same as instance method but provides the default user_data_dir as well. | |
75 // Note that in case of a guest account this will return a 'suitable' profile. | 70 // Note that in case of a guest account this will return a 'suitable' profile. |
76 static Profile* GetDefaultProfile(); | 71 static Profile* GetDefaultProfile(); |
77 | 72 |
78 // DEPRECATED: DO NOT USE unless in ChromeOS. | |
79 // Same as GetDefaultProfile(). Do not use. | |
80 static Profile* GetDefaultProfileOrOffTheRecord(); | |
81 | |
82 // Returns a profile for a specific profile directory within the user data | 73 // Returns a profile for a specific profile directory within the user data |
83 // dir. This will return an existing profile it had already been created, | 74 // dir. This will return an existing profile it had already been created, |
84 // otherwise it will create and manage it. | 75 // otherwise it will create and manage it. |
85 Profile* GetProfile(const base::FilePath& profile_dir); | 76 Profile* GetProfile(const base::FilePath& profile_dir); |
86 | 77 |
87 // Returns total number of profiles available on this machine. | 78 // Returns total number of profiles available on this machine. |
88 size_t GetNumberOfProfiles(); | 79 size_t GetNumberOfProfiles(); |
89 | 80 |
90 // Explicit asynchronous creation of a profile located at |profile_path|. | 81 // Explicit asynchronous creation of a profile located at |profile_path|. |
91 // If the profile has already been created then callback is called | 82 // If the profile has already been created then callback is called |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // Whether or not this profile should have a shortcut. | 252 // Whether or not this profile should have a shortcut. |
262 bool create_shortcut; | 253 bool create_shortcut; |
263 // List of callbacks to run when profile initialization is done. Note, when | 254 // List of callbacks to run when profile initialization is done. Note, when |
264 // profile is fully loaded this vector will be empty. | 255 // profile is fully loaded this vector will be empty. |
265 std::vector<CreateCallback> callbacks; | 256 std::vector<CreateCallback> callbacks; |
266 | 257 |
267 private: | 258 private: |
268 DISALLOW_COPY_AND_ASSIGN(ProfileInfo); | 259 DISALLOW_COPY_AND_ASSIGN(ProfileInfo); |
269 }; | 260 }; |
270 | 261 |
| 262 // Returns the profile of the active user and / or the off the record profile |
| 263 // if needed. This adds the profile to the ProfileManager if it doesn't |
| 264 // already exist. The method will return NULL if the profile doesn't exist |
| 265 // and we can't create it. |
| 266 // The profile used can be overridden by using --login-profile on cros. |
| 267 Profile* GetActiveUserOrOffTheRecordProfileFromPath( |
| 268 const base::FilePath& user_data_dir); |
| 269 |
271 // Adds a pre-existing Profile object to the set managed by this | 270 // Adds a pre-existing Profile object to the set managed by this |
272 // ProfileManager. This ProfileManager takes ownership of the Profile. | 271 // ProfileManager. This ProfileManager takes ownership of the Profile. |
273 // The Profile should not already be managed by this ProfileManager. | 272 // The Profile should not already be managed by this ProfileManager. |
274 // Returns true if the profile was added, false otherwise. | 273 // Returns true if the profile was added, false otherwise. |
275 bool AddProfile(Profile* profile); | 274 bool AddProfile(Profile* profile); |
276 | 275 |
277 // Schedules the profile at the given path to be deleted on shutdown. | 276 // Schedules the profile at the given path to be deleted on shutdown. |
278 void FinishDeletingProfile(const base::FilePath& profile_dir); | 277 void FinishDeletingProfile(const base::FilePath& profile_dir); |
279 | 278 |
280 // Registers profile with given info. Returns pointer to created ProfileInfo | 279 // Registers profile with given info. Returns pointer to created ProfileInfo |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 class ProfileManagerWithoutInit : public ProfileManager { | 374 class ProfileManagerWithoutInit : public ProfileManager { |
376 public: | 375 public: |
377 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 376 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
378 | 377 |
379 protected: | 378 protected: |
380 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 379 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
381 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 380 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
382 }; | 381 }; |
383 | 382 |
384 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 383 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |