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 17 matching lines...) Expand all Loading... | |
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 ProfileInfoCache; | 31 class ProfileInfoCache; |
32 | 32 |
33 class ProfileManager : public base::NonThreadSafe, | 33 class ProfileManager : public base::NonThreadSafe, |
34 public content::NotificationObserver, | 34 public content::NotificationObserver, |
35 public Profile::Delegate { | 35 public Profile::Delegate { |
36 public: | 36 public: |
37 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; | 37 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; |
38 typedef base::Callback<void(Profile*)> ProfileLoadedCallback; | |
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; |
41 | 42 |
42 #if defined(ENABLE_SESSION_SERVICE) | 43 #if defined(ENABLE_SESSION_SERVICE) |
43 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. | 44 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. |
44 static void ShutdownSessionServices(); | 45 static void ShutdownSessionServices(); |
45 #endif | 46 #endif |
46 | 47 |
47 // Physically remove deleted profile directories from disk. | 48 // Physically remove deleted profile directories from disk. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // Because this method might synchronously create a new profile, it should | 81 // Because this method might synchronously create a new profile, it should |
81 // only be called for the initial profile or in tests, where blocking is | 82 // only be called for the initial profile or in tests, where blocking is |
82 // acceptable. | 83 // acceptable. |
83 // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then | 84 // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then |
84 // make this method private. | 85 // make this method private. |
85 Profile* GetProfile(const base::FilePath& profile_dir); | 86 Profile* GetProfile(const base::FilePath& profile_dir); |
86 | 87 |
87 // Returns total number of profiles available on this machine. | 88 // Returns total number of profiles available on this machine. |
88 size_t GetNumberOfProfiles(); | 89 size_t GetNumberOfProfiles(); |
89 | 90 |
91 // Loads an existing profile given it's |profile_name| | |
92 // The profile is loaded asynchronously and |callback| is executed once it's | |
93 // loaded | |
94 // The callback will be executed with a NULL profile if there is an error. | |
95 // Should be called on the UI thread. | |
Peter Beverloo
2016/03/11 17:45:15
This should document |incognito| as well, have pro
Peter Beverloo
2016/03/11 17:45:15
Should we match GetProfile() above and swap out th
Miguel Garcia
2016/03/14 18:29:00
Done.
Miguel Garcia
2016/03/14 18:29:00
Let's let the owners decide. I am fine swapping it
| |
96 void LoadProfile(const std::string& profile_name, | |
97 bool incognito, | |
98 const ProfileLoadedCallback& callback); | |
99 | |
90 // Explicit asynchronous creation of a profile located at |profile_path|. | 100 // Explicit asynchronous creation of a profile located at |profile_path|. |
91 // If the profile has already been created then callback is called | 101 // If the profile has already been created then callback is called |
92 // immediately. Should be called on the UI thread. | 102 // immediately. Should be called on the UI thread. |
93 void CreateProfileAsync(const base::FilePath& profile_path, | 103 void CreateProfileAsync(const base::FilePath& profile_path, |
94 const CreateCallback& callback, | 104 const CreateCallback& callback, |
95 const base::string16& name, | 105 const base::string16& name, |
96 const std::string& icon_url, | 106 const std::string& icon_url, |
97 const std::string& supervised_user_id); | 107 const std::string& supervised_user_id); |
98 | 108 |
99 // Returns true if the profile pointer is known to point to an existing | 109 // Returns true if the profile pointer is known to point to an existing |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 class ProfileManagerWithoutInit : public ProfileManager { | 399 class ProfileManagerWithoutInit : public ProfileManager { |
390 public: | 400 public: |
391 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 401 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
392 | 402 |
393 protected: | 403 protected: |
394 void DoFinalInitForServices(Profile*, bool) override {} | 404 void DoFinalInitForServices(Profile*, bool) override {} |
395 void DoFinalInitLogging(Profile*) override {} | 405 void DoFinalInitLogging(Profile*) override {} |
396 }; | 406 }; |
397 | 407 |
398 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 408 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |