| 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 | 39 |
| 39 explicit ProfileManager(const base::FilePath& user_data_dir); | 40 explicit ProfileManager(const base::FilePath& user_data_dir); |
| 40 ~ProfileManager() override; | 41 ~ProfileManager() override; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // Checks if any ephemeral profiles are left behind (e.g. because of a browser | 189 // Checks if any ephemeral profiles are left behind (e.g. because of a browser |
| 189 // crash) and schedule them for deletion. | 190 // crash) and schedule them for deletion. |
| 190 void CleanUpEphemeralProfiles(); | 191 void CleanUpEphemeralProfiles(); |
| 191 | 192 |
| 192 // Initializes user prefs of |profile|. This includes profile name and | 193 // Initializes user prefs of |profile|. This includes profile name and |
| 193 // avatar values. | 194 // avatar values. |
| 194 void InitProfileUserPrefs(Profile* profile); | 195 void InitProfileUserPrefs(Profile* profile); |
| 195 | 196 |
| 196 // Register and add testing profile to the ProfileManager. Use ONLY in tests. | 197 // Register and add testing profile to the ProfileManager. Use ONLY in tests. |
| 197 // This allows the creation of Profiles outside of the standard creation path | 198 // This allows the creation of Profiles outside of the standard creation path |
| 198 // for testing. If |addToCache|, adds to ProfileInfoCache as well. | 199 // for testing. If |addToStorage|, adds to ProfileAttributesStorage as well. |
| 199 // If |start_deferred_task_runners|, starts the deferred task runners. | 200 // If |start_deferred_task_runners|, starts the deferred task runners. |
| 200 // Use ONLY in tests. | 201 // Use ONLY in tests. |
| 201 void RegisterTestingProfile(Profile* profile, | 202 void RegisterTestingProfile(Profile* profile, |
| 202 bool addToCache, | 203 bool addToStorage, |
| 203 bool start_deferred_task_runners); | 204 bool start_deferred_task_runners); |
| 204 | 205 |
| 205 const base::FilePath& user_data_dir() const { return user_data_dir_; } | 206 const base::FilePath& user_data_dir() const { return user_data_dir_; } |
| 206 | 207 |
| 207 // For ChromeOS, determines if the user has logged in to a real profile. | 208 // For ChromeOS, determines if the user has logged in to a real profile. |
| 208 bool IsLoggedIn() const { return logged_in_; } | 209 bool IsLoggedIn() const { return logged_in_; } |
| 209 | 210 |
| 210 // content::NotificationObserver implementation. | 211 // content::NotificationObserver implementation. |
| 211 void Observe(int type, | 212 void Observe(int type, |
| 212 const content::NotificationSource& source, | 213 const content::NotificationSource& source, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 289 |
| 289 // Returns ProfileInfo associated with given |path|, registered earlier with | 290 // Returns ProfileInfo associated with given |path|, registered earlier with |
| 290 // RegisterProfile. | 291 // RegisterProfile. |
| 291 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; | 292 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; |
| 292 | 293 |
| 293 // Returns a registered profile. In contrast to GetProfileByPath(), this will | 294 // Returns a registered profile. In contrast to GetProfileByPath(), this will |
| 294 // also return a profile that is not fully initialized yet, so this method | 295 // also return a profile that is not fully initialized yet, so this method |
| 295 // should be used carefully. | 296 // should be used carefully. |
| 296 Profile* GetProfileByPathInternal(const base::FilePath& path) const; | 297 Profile* GetProfileByPathInternal(const base::FilePath& path) const; |
| 297 | 298 |
| 298 // Adds |profile| to the profile info cache if it hasn't been added yet. | 299 // Adds |profile| to the profile attributes storage if it hasn't been added |
| 299 void AddProfileToCache(Profile* profile); | 300 // yet. |
| 301 void AddProfileToStorage(Profile* profile); |
| 300 | 302 |
| 301 // Apply settings for profiles created by the system rather than users: The | 303 // Apply settings for profiles created by the system rather than users: The |
| 302 // (desktop) Guest User profile and (desktop) System Profile. | 304 // (desktop) Guest User profile and (desktop) System Profile. |
| 303 void SetNonPersonalProfilePrefs(Profile* profile); | 305 void SetNonPersonalProfilePrefs(Profile* profile); |
| 304 | 306 |
| 305 // For ChromeOS, determines if profile should be otr. | 307 // For ChromeOS, determines if profile should be otr. |
| 306 bool ShouldGoOffTheRecord(Profile* profile); | 308 bool ShouldGoOffTheRecord(Profile* profile); |
| 307 | 309 |
| 308 void RunCallbacks(const std::vector<CreateCallback>& callbacks, | 310 void RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 309 Profile* profile, | 311 Profile* profile, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 class ProfileManagerWithoutInit : public ProfileManager { | 391 class ProfileManagerWithoutInit : public ProfileManager { |
| 390 public: | 392 public: |
| 391 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 393 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
| 392 | 394 |
| 393 protected: | 395 protected: |
| 394 void DoFinalInitForServices(Profile*, bool) override {} | 396 void DoFinalInitForServices(Profile*, bool) override {} |
| 395 void DoFinalInitLogging(Profile*) override {} | 397 void DoFinalInitLogging(Profile*) override {} |
| 396 }; | 398 }; |
| 397 | 399 |
| 398 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 400 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |