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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Returns total number of profiles available on this machine. | 79 // Returns total number of profiles available on this machine. |
80 size_t GetNumberOfProfiles(); | 80 size_t GetNumberOfProfiles(); |
81 | 81 |
82 // Explicit asynchronous creation of a profile located at |profile_path|. | 82 // Explicit asynchronous creation of a profile located at |profile_path|. |
83 // If the profile has already been created then callback is called | 83 // If the profile has already been created then callback is called |
84 // immediately. Should be called on the UI thread. | 84 // immediately. Should be called on the UI thread. |
85 void CreateProfileAsync(const base::FilePath& profile_path, | 85 void CreateProfileAsync(const base::FilePath& profile_path, |
86 const CreateCallback& callback, | 86 const CreateCallback& callback, |
87 const base::string16& name, | 87 const base::string16& name, |
88 const base::string16& icon_url, | 88 const base::string16& icon_url, |
89 const std::string& managed_user_id); | 89 const std::string& supervised_user_id); |
90 | 90 |
91 // Returns true if the profile pointer is known to point to an existing | 91 // Returns true if the profile pointer is known to point to an existing |
92 // profile. | 92 // profile. |
93 bool IsValidProfile(Profile* profile); | 93 bool IsValidProfile(Profile* profile); |
94 | 94 |
95 // Returns the directory where the first created profile is stored, | 95 // Returns the directory where the first created profile is stored, |
96 // relative to the user data directory currently in use. | 96 // relative to the user data directory currently in use. |
97 base::FilePath GetInitialProfileDir(); | 97 base::FilePath GetInitialProfileDir(); |
98 | 98 |
99 // Get the Profile last used (the Profile to which owns the most recently | 99 // Get the Profile last used (the Profile to which owns the most recently |
(...skipping 27 matching lines...) Expand all Loading... |
127 // creation. (Because directories can be removed, however, it may be the case | 127 // creation. (Because directories can be removed, however, it may be the case |
128 // that at some point the list of numbered profiles is not continuous.) | 128 // that at some point the list of numbered profiles is not continuous.) |
129 // |callback| may be invoked multiple times (for CREATE_STATUS_INITIALIZED | 129 // |callback| may be invoked multiple times (for CREATE_STATUS_INITIALIZED |
130 // and CREATE_STATUS_CREATED) so binding parameters with bind::Passed() is | 130 // and CREATE_STATUS_CREATED) so binding parameters with bind::Passed() is |
131 // prohibited. Returns the file path to the profile that will be created | 131 // prohibited. Returns the file path to the profile that will be created |
132 // asynchronously. | 132 // asynchronously. |
133 static base::FilePath CreateMultiProfileAsync( | 133 static base::FilePath CreateMultiProfileAsync( |
134 const base::string16& name, | 134 const base::string16& name, |
135 const base::string16& icon_url, | 135 const base::string16& icon_url, |
136 const CreateCallback& callback, | 136 const CreateCallback& callback, |
137 const std::string& managed_user_id); | 137 const std::string& supervised_user_id); |
138 | 138 |
139 // Returns the full path to be used for guest profiles. | 139 // Returns the full path to be used for guest profiles. |
140 static base::FilePath GetGuestProfilePath(); | 140 static base::FilePath GetGuestProfilePath(); |
141 | 141 |
142 // Get the path of the next profile directory and increment the internal | 142 // Get the path of the next profile directory and increment the internal |
143 // count. | 143 // count. |
144 // Lack of side effects: | 144 // Lack of side effects: |
145 // This function doesn't actually create the directory or touch the file | 145 // This function doesn't actually create the directory or touch the file |
146 // system. | 146 // system. |
147 base::FilePath GenerateNextProfileDirectoryPath(); | 147 base::FilePath GenerateNextProfileDirectoryPath(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 private: | 291 private: |
292 ProfileManager* profile_manager_; | 292 ProfileManager* profile_manager_; |
293 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); | 293 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); |
294 }; | 294 }; |
295 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 295 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
296 | 296 |
297 #if defined(OS_MACOSX) | 297 #if defined(OS_MACOSX) |
298 // If the |loaded_profile| has been loaded successfully (according to | 298 // If the |loaded_profile| has been loaded successfully (according to |
299 // |status|) and isn't already scheduled for deletion, then finishes adding | 299 // |status|) and isn't already scheduled for deletion, then finishes adding |
300 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates | 300 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates |
301 // the kProfileLastUsed preference based on |last_non_managed_profile_path|. | 301 // the kProfileLastUsed preference based on |
| 302 // |last_non_supervised_profile_path|. |
302 void OnNewActiveProfileLoaded( | 303 void OnNewActiveProfileLoaded( |
303 const base::FilePath& profile_to_delete_path, | 304 const base::FilePath& profile_to_delete_path, |
304 const base::FilePath& last_non_managed_profile_path, | 305 const base::FilePath& last_non_supervised_profile_path, |
305 const CreateCallback& original_callback, | 306 const CreateCallback& original_callback, |
306 Profile* loaded_profile, | 307 Profile* loaded_profile, |
307 Profile::CreateStatus status); | 308 Profile::CreateStatus status); |
308 #endif | 309 #endif |
309 | 310 |
310 content::NotificationRegistrar registrar_; | 311 content::NotificationRegistrar registrar_; |
311 | 312 |
312 // The path to the user data directory (DIR_USER_DATA). | 313 // The path to the user data directory (DIR_USER_DATA). |
313 const base::FilePath user_data_dir_; | 314 const base::FilePath user_data_dir_; |
314 | 315 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 class ProfileManagerWithoutInit : public ProfileManager { | 351 class ProfileManagerWithoutInit : public ProfileManager { |
351 public: | 352 public: |
352 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 353 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
353 | 354 |
354 protected: | 355 protected: |
355 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 356 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
356 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 357 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
357 }; | 358 }; |
358 | 359 |
359 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 360 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |