| 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
| 22 #include "base/threading/non_thread_safe.h" | 22 #include "base/threading/non_thread_safe.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 25 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 26 #include "chrome/browser/ui/browser_list_observer.h" | 26 #include "chrome/browser/ui/browser_list_observer.h" |
| 27 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
| 28 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
| 29 | 29 |
| 30 class NewProfileLauncher; | 30 class NewProfileLauncher; |
| 31 class ProfileAttributesStorage; |
| 31 class ProfileInfoCache; | 32 class ProfileInfoCache; |
| 32 | 33 |
| 33 class ProfileManager : public base::NonThreadSafe, | 34 class ProfileManager : public base::NonThreadSafe, |
| 34 public content::NotificationObserver, | 35 public content::NotificationObserver, |
| 35 public Profile::Delegate { | 36 public Profile::Delegate { |
| 36 public: | 37 public: |
| 37 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; | 38 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; |
| 38 typedef base::Callback<void(Profile*)> ProfileLoadedCallback; | 39 typedef base::Callback<void(Profile*)> ProfileLoadedCallback; |
| 39 | 40 |
| 40 explicit ProfileManager(const base::FilePath& user_data_dir); | 41 explicit ProfileManager(const base::FilePath& user_data_dir); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // Checks if any ephemeral profiles are left behind (e.g. because of a browser | 202 // Checks if any ephemeral profiles are left behind (e.g. because of a browser |
| 202 // crash) and schedule them for deletion. | 203 // crash) and schedule them for deletion. |
| 203 void CleanUpEphemeralProfiles(); | 204 void CleanUpEphemeralProfiles(); |
| 204 | 205 |
| 205 // Initializes user prefs of |profile|. This includes profile name and | 206 // Initializes user prefs of |profile|. This includes profile name and |
| 206 // avatar values. | 207 // avatar values. |
| 207 void InitProfileUserPrefs(Profile* profile); | 208 void InitProfileUserPrefs(Profile* profile); |
| 208 | 209 |
| 209 // Register and add testing profile to the ProfileManager. Use ONLY in tests. | 210 // Register and add testing profile to the ProfileManager. Use ONLY in tests. |
| 210 // This allows the creation of Profiles outside of the standard creation path | 211 // This allows the creation of Profiles outside of the standard creation path |
| 211 // for testing. If |addToCache|, adds to ProfileInfoCache as well. | 212 // for testing. If |addToStorage|, adds to ProfileAttributesStorage as well. |
| 212 // If |start_deferred_task_runners|, starts the deferred task runners. | 213 // If |start_deferred_task_runners|, starts the deferred task runners. |
| 213 // Use ONLY in tests. | 214 // Use ONLY in tests. |
| 214 void RegisterTestingProfile(Profile* profile, | 215 void RegisterTestingProfile(Profile* profile, |
| 215 bool addToCache, | 216 bool addToStorage, |
| 216 bool start_deferred_task_runners); | 217 bool start_deferred_task_runners); |
| 217 | 218 |
| 218 const base::FilePath& user_data_dir() const { return user_data_dir_; } | 219 const base::FilePath& user_data_dir() const { return user_data_dir_; } |
| 219 | 220 |
| 220 // For ChromeOS, determines if the user has logged in to a real profile. | 221 // For ChromeOS, determines if the user has logged in to a real profile. |
| 221 bool IsLoggedIn() const { return logged_in_; } | 222 bool IsLoggedIn() const { return logged_in_; } |
| 222 | 223 |
| 223 // content::NotificationObserver implementation. | 224 // content::NotificationObserver implementation. |
| 224 void Observe(int type, | 225 void Observe(int type, |
| 225 const content::NotificationSource& source, | 226 const content::NotificationSource& source, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 302 |
| 302 // Returns ProfileInfo associated with given |path|, registered earlier with | 303 // Returns ProfileInfo associated with given |path|, registered earlier with |
| 303 // RegisterProfile. | 304 // RegisterProfile. |
| 304 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; | 305 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; |
| 305 | 306 |
| 306 // Returns a registered profile. In contrast to GetProfileByPath(), this will | 307 // Returns a registered profile. In contrast to GetProfileByPath(), this will |
| 307 // also return a profile that is not fully initialized yet, so this method | 308 // also return a profile that is not fully initialized yet, so this method |
| 308 // should be used carefully. | 309 // should be used carefully. |
| 309 Profile* GetProfileByPathInternal(const base::FilePath& path) const; | 310 Profile* GetProfileByPathInternal(const base::FilePath& path) const; |
| 310 | 311 |
| 311 // Adds |profile| to the profile info cache if it hasn't been added yet. | 312 // Adds |profile| to the profile attributes storage if it hasn't been added |
| 312 void AddProfileToCache(Profile* profile); | 313 // yet. |
| 314 void AddProfileToStorage(Profile* profile); |
| 313 | 315 |
| 314 // Apply settings for profiles created by the system rather than users: The | 316 // Apply settings for profiles created by the system rather than users: The |
| 315 // (desktop) Guest User profile and (desktop) System Profile. | 317 // (desktop) Guest User profile and (desktop) System Profile. |
| 316 void SetNonPersonalProfilePrefs(Profile* profile); | 318 void SetNonPersonalProfilePrefs(Profile* profile); |
| 317 | 319 |
| 318 // For ChromeOS, determines if profile should be otr. | 320 // For ChromeOS, determines if profile should be otr. |
| 319 bool ShouldGoOffTheRecord(Profile* profile); | 321 bool ShouldGoOffTheRecord(Profile* profile); |
| 320 | 322 |
| 321 void RunCallbacks(const std::vector<CreateCallback>& callbacks, | 323 void RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 322 Profile* profile, | 324 Profile* profile, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 class ProfileManagerWithoutInit : public ProfileManager { | 404 class ProfileManagerWithoutInit : public ProfileManager { |
| 403 public: | 405 public: |
| 404 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 406 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
| 405 | 407 |
| 406 protected: | 408 protected: |
| 407 void DoFinalInitForServices(Profile*, bool) override {} | 409 void DoFinalInitForServices(Profile*, bool) override {} |
| 408 void DoFinalInitLogging(Profile*) override {} | 410 void DoFinalInitLogging(Profile*) override {} |
| 409 }; | 411 }; |
| 410 | 412 |
| 411 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 413 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |