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 16 matching lines...) Expand all Loading... |
27 class NewProfileLauncher; | 27 class NewProfileLauncher; |
28 class ProfileInfoCache; | 28 class ProfileInfoCache; |
29 | 29 |
30 class ProfileManager : public base::NonThreadSafe, | 30 class ProfileManager : public base::NonThreadSafe, |
31 public content::NotificationObserver, | 31 public content::NotificationObserver, |
32 public Profile::Delegate { | 32 public Profile::Delegate { |
33 public: | 33 public: |
34 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; | 34 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; |
35 | 35 |
36 explicit ProfileManager(const base::FilePath& user_data_dir); | 36 explicit ProfileManager(const base::FilePath& user_data_dir); |
37 virtual ~ProfileManager(); | 37 ~ProfileManager() override; |
38 | 38 |
39 #if defined(ENABLE_SESSION_SERVICE) | 39 #if defined(ENABLE_SESSION_SERVICE) |
40 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. | 40 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. |
41 static void ShutdownSessionServices(); | 41 static void ShutdownSessionServices(); |
42 #endif | 42 #endif |
43 | 43 |
44 // Physically remove deleted profile directories from disk. | 44 // Physically remove deleted profile directories from disk. |
45 static void NukeDeletedProfilesFromDisk(); | 45 static void NukeDeletedProfilesFromDisk(); |
46 | 46 |
47 // Same as instance method but provides the default user_data_dir as well. | 47 // Same as instance method but provides the default user_data_dir as well. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void RegisterTestingProfile(Profile* profile, | 181 void RegisterTestingProfile(Profile* profile, |
182 bool addToCache, | 182 bool addToCache, |
183 bool start_deferred_task_runners); | 183 bool start_deferred_task_runners); |
184 | 184 |
185 const base::FilePath& user_data_dir() const { return user_data_dir_; } | 185 const base::FilePath& user_data_dir() const { return user_data_dir_; } |
186 | 186 |
187 // For ChromeOS, determines if the user has logged in to a real profile. | 187 // For ChromeOS, determines if the user has logged in to a real profile. |
188 bool IsLoggedIn() const { return logged_in_; } | 188 bool IsLoggedIn() const { return logged_in_; } |
189 | 189 |
190 // content::NotificationObserver implementation. | 190 // content::NotificationObserver implementation. |
191 virtual void Observe(int type, | 191 void Observe(int type, |
192 const content::NotificationSource& source, | 192 const content::NotificationSource& source, |
193 const content::NotificationDetails& details) override; | 193 const content::NotificationDetails& details) override; |
194 | 194 |
195 // Profile::Delegate implementation: | 195 // Profile::Delegate implementation: |
196 virtual void OnProfileCreated(Profile* profile, | 196 void OnProfileCreated(Profile* profile, |
197 bool success, | 197 bool success, |
198 bool is_new_profile) override; | 198 bool is_new_profile) override; |
199 | 199 |
200 protected: | 200 protected: |
201 // Does final initial actions. | 201 // Does final initial actions. |
202 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); | 202 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); |
203 virtual void DoFinalInitForServices(Profile* profile, bool go_off_the_record); | 203 virtual void DoFinalInitForServices(Profile* profile, bool go_off_the_record); |
204 virtual void DoFinalInitLogging(Profile* profile); | 204 virtual void DoFinalInitLogging(Profile* profile); |
205 | 205 |
206 // Creates a new profile by calling into the profile's profile creation | 206 // Creates a new profile by calling into the profile's profile creation |
207 // method. Virtual so that unittests can return a TestingProfile instead | 207 // method. Virtual so that unittests can return a TestingProfile instead |
208 // of the Profile's result. | 208 // of the Profile's result. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 280 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
281 // Updates the last active user of the current session. | 281 // Updates the last active user of the current session. |
282 // On Chrome OS updating this user will have no effect since when browser is | 282 // On Chrome OS updating this user will have no effect since when browser is |
283 // restored after crash there's another preference that is taken into account. | 283 // restored after crash there's another preference that is taken into account. |
284 // See kLastActiveUser in UserManagerBase. | 284 // See kLastActiveUser in UserManagerBase. |
285 void UpdateLastUser(Profile* last_active); | 285 void UpdateLastUser(Profile* last_active); |
286 | 286 |
287 class BrowserListObserver : public chrome::BrowserListObserver { | 287 class BrowserListObserver : public chrome::BrowserListObserver { |
288 public: | 288 public: |
289 explicit BrowserListObserver(ProfileManager* manager); | 289 explicit BrowserListObserver(ProfileManager* manager); |
290 virtual ~BrowserListObserver(); | 290 ~BrowserListObserver() override; |
291 | 291 |
292 // chrome::BrowserListObserver implementation. | 292 // chrome::BrowserListObserver implementation. |
293 virtual void OnBrowserAdded(Browser* browser) override; | 293 void OnBrowserAdded(Browser* browser) override; |
294 virtual void OnBrowserRemoved(Browser* browser) override; | 294 void OnBrowserRemoved(Browser* browser) override; |
295 virtual void OnBrowserSetLastActive(Browser* browser) override; | 295 void OnBrowserSetLastActive(Browser* browser) override; |
296 | 296 |
297 private: | 297 private: |
298 ProfileManager* profile_manager_; | 298 ProfileManager* profile_manager_; |
299 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); | 299 DISALLOW_COPY_AND_ASSIGN(BrowserListObserver); |
300 }; | 300 }; |
301 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 301 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
302 | 302 |
303 #if defined(OS_MACOSX) | 303 #if defined(OS_MACOSX) |
304 // If the |loaded_profile| has been loaded successfully (according to | 304 // If the |loaded_profile| has been loaded successfully (according to |
305 // |status|) and isn't already scheduled for deletion, then finishes adding | 305 // |status|) and isn't already scheduled for deletion, then finishes adding |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 DISALLOW_COPY_AND_ASSIGN(ProfileManager); | 352 DISALLOW_COPY_AND_ASSIGN(ProfileManager); |
353 }; | 353 }; |
354 | 354 |
355 // Same as the ProfileManager, but doesn't initialize some services of the | 355 // Same as the ProfileManager, but doesn't initialize some services of the |
356 // profile. This one is useful in unittests. | 356 // profile. This one is useful in unittests. |
357 class ProfileManagerWithoutInit : public ProfileManager { | 357 class ProfileManagerWithoutInit : public ProfileManager { |
358 public: | 358 public: |
359 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 359 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
360 | 360 |
361 protected: | 361 protected: |
362 virtual void DoFinalInitForServices(Profile*, bool) override {} | 362 void DoFinalInitForServices(Profile*, bool) override {} |
363 virtual void DoFinalInitLogging(Profile*) override {} | 363 void DoFinalInitLogging(Profile*) override {} |
364 }; | 364 }; |
365 | 365 |
366 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 366 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |