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 // and marks the new profile as active. | 269 void FinishDeletingProfile(const base::FilePath& profile_dir); |
270 void FinishDeletingProfile(const base::FilePath& profile_dir, | |
271 const base::FilePath& new_active_profile_dir); | |
272 | 270 |
273 // Registers profile with given info. Returns pointer to created ProfileInfo | 271 // Registers profile with given info. Returns pointer to created ProfileInfo |
274 // entry. | 272 // entry. |
275 ProfileInfo* RegisterProfile(Profile* profile, bool created); | 273 ProfileInfo* RegisterProfile(Profile* profile, bool created); |
276 | 274 |
277 // Returns ProfileInfo associated with given |path|, registered earlier with | 275 // Returns ProfileInfo associated with given |path|, registered earlier with |
278 // RegisterProfile. | 276 // RegisterProfile. |
279 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; | 277 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; |
280 | 278 |
281 // Returns a registered profile. In contrast to GetProfileByPath(), this will | 279 // Returns a registered profile. In contrast to GetProfileByPath(), this will |
(...skipping 30 matching lines...) Expand all Loading... |
312 void OnBrowserAdded(Browser* browser) override; | 310 void OnBrowserAdded(Browser* browser) override; |
313 void OnBrowserRemoved(Browser* browser) override; | 311 void OnBrowserRemoved(Browser* browser) override; |
314 void OnBrowserSetLastActive(Browser* browser) override; | 312 void OnBrowserSetLastActive(Browser* browser) override; |
315 | 313 |
316 private: | 314 private: |
317 ProfileManager* profile_manager_; | 315 ProfileManager* profile_manager_; |
318 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); | 316 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); |
319 }; | 317 }; |
320 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 318 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
321 | 319 |
| 320 #if defined(OS_MACOSX) |
322 // If the |loaded_profile| has been loaded successfully (according to | 321 // If the |loaded_profile| has been loaded successfully (according to |
323 // |status|) and isn't already scheduled for deletion, then finishes adding | 322 // |status|) and isn't already scheduled for deletion, then finishes adding |
324 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates | 323 // |profile_to_delete_dir| to the queue of profiles to be deleted, and updates |
325 // the kProfileLastUsed preference based on | 324 // the kProfileLastUsed preference based on |
326 // |last_non_supervised_profile_path|. | 325 // |last_non_supervised_profile_path|. |
327 void OnNewActiveProfileLoaded( | 326 void OnNewActiveProfileLoaded( |
328 const base::FilePath& profile_to_delete_path, | 327 const base::FilePath& profile_to_delete_path, |
329 const base::FilePath& last_non_supervised_profile_path, | 328 const base::FilePath& last_non_supervised_profile_path, |
330 const CreateCallback& original_callback, | 329 const CreateCallback& original_callback, |
331 Profile* loaded_profile, | 330 Profile* loaded_profile, |
332 Profile::CreateStatus status); | 331 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 |