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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 22 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
23 #include "chrome/browser/ui/browser_list_observer.h" | 23 #include "chrome/browser/ui/browser_list_observer.h" |
| 24 #include "components/user_manager/user_id.h" |
24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
26 | 27 |
27 class NewProfileLauncher; | 28 class NewProfileLauncher; |
28 class ProfileInfoCache; | 29 class ProfileInfoCache; |
29 | 30 |
30 class ProfileManager : public base::NonThreadSafe, | 31 class ProfileManager : public base::NonThreadSafe, |
31 public content::NotificationObserver, | 32 public content::NotificationObserver, |
32 public Profile::Delegate { | 33 public Profile::Delegate { |
33 public: | 34 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Returns total number of profiles available on this machine. | 85 // Returns total number of profiles available on this machine. |
85 size_t GetNumberOfProfiles(); | 86 size_t GetNumberOfProfiles(); |
86 | 87 |
87 // Explicit asynchronous creation of a profile located at |profile_path|. | 88 // Explicit asynchronous creation of a profile located at |profile_path|. |
88 // If the profile has already been created then callback is called | 89 // If the profile has already been created then callback is called |
89 // immediately. Should be called on the UI thread. | 90 // immediately. Should be called on the UI thread. |
90 void CreateProfileAsync(const base::FilePath& profile_path, | 91 void CreateProfileAsync(const base::FilePath& profile_path, |
91 const CreateCallback& callback, | 92 const CreateCallback& callback, |
92 const base::string16& name, | 93 const base::string16& name, |
93 const base::string16& icon_url, | 94 const base::string16& icon_url, |
94 const std::string& supervised_user_id); | 95 const user_manager::UserID& supervised_user_id); |
95 | 96 |
96 // Returns true if the profile pointer is known to point to an existing | 97 // Returns true if the profile pointer is known to point to an existing |
97 // profile. | 98 // profile. |
98 bool IsValidProfile(Profile* profile); | 99 bool IsValidProfile(Profile* profile); |
99 | 100 |
100 // Returns the directory where the first created profile is stored, | 101 // Returns the directory where the first created profile is stored, |
101 // relative to the user data directory currently in use. | 102 // relative to the user data directory currently in use. |
102 base::FilePath GetInitialProfileDir(); | 103 base::FilePath GetInitialProfileDir(); |
103 | 104 |
104 // Get the Profile last used (the Profile to which owns the most recently | 105 // Get the Profile last used (the Profile to which owns the most recently |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // creation. (Because directories can be removed, however, it may be the case | 137 // creation. (Because directories can be removed, however, it may be the case |
137 // that at some point the list of numbered profiles is not continuous.) | 138 // that at some point the list of numbered profiles is not continuous.) |
138 // |callback| may be invoked multiple times (for CREATE_STATUS_INITIALIZED | 139 // |callback| may be invoked multiple times (for CREATE_STATUS_INITIALIZED |
139 // and CREATE_STATUS_CREATED) so binding parameters with bind::Passed() is | 140 // and CREATE_STATUS_CREATED) so binding parameters with bind::Passed() is |
140 // prohibited. Returns the file path to the profile that will be created | 141 // prohibited. Returns the file path to the profile that will be created |
141 // asynchronously. | 142 // asynchronously. |
142 static base::FilePath CreateMultiProfileAsync( | 143 static base::FilePath CreateMultiProfileAsync( |
143 const base::string16& name, | 144 const base::string16& name, |
144 const base::string16& icon_url, | 145 const base::string16& icon_url, |
145 const CreateCallback& callback, | 146 const CreateCallback& callback, |
146 const std::string& supervised_user_id); | 147 const user_manager::UserID& supervised_user_id); |
147 | 148 |
148 // Returns the full path to be used for guest profiles. | 149 // Returns the full path to be used for guest profiles. |
149 static base::FilePath GetGuestProfilePath(); | 150 static base::FilePath GetGuestProfilePath(); |
150 | 151 |
151 // Returns the full path to be used for system profiles. | 152 // Returns the full path to be used for system profiles. |
152 static base::FilePath GetSystemProfilePath(); | 153 static base::FilePath GetSystemProfilePath(); |
153 | 154 |
154 // Get the path of the next profile directory and increment the internal | 155 // Get the path of the next profile directory and increment the internal |
155 // count. | 156 // count. |
156 // Lack of side effects: | 157 // Lack of side effects: |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 class ProfileManagerWithoutInit : public ProfileManager { | 375 class ProfileManagerWithoutInit : public ProfileManager { |
375 public: | 376 public: |
376 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 377 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
377 | 378 |
378 protected: | 379 protected: |
379 void DoFinalInitForServices(Profile*, bool) override {} | 380 void DoFinalInitForServices(Profile*, bool) override {} |
380 void DoFinalInitLogging(Profile*) override {} | 381 void DoFinalInitLogging(Profile*) override {} |
381 }; | 382 }; |
382 | 383 |
383 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 384 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |