OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/hash_tables.h" | 16 #include "base/hash_tables.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.h" | 19 #include "base/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/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
23 #include "content/common/notification_observer.h" | 23 #include "content/common/notification_observer.h" |
24 #include "content/common/notification_registrar.h" | 24 #include "content/common/notification_registrar.h" |
25 | 25 |
26 class FilePath; | 26 class FilePath; |
27 class NewProfileLauncher; | 27 class NewProfileLauncher; |
28 class ProfileInfoCache; | 28 class ProfileInfoCache; |
29 class ProfileInfoInterface; | |
30 | 29 |
31 class ProfileManagerObserver { | 30 class ProfileManagerObserver { |
32 public: | 31 public: |
33 enum Status { | 32 enum Status { |
34 // So epic. | 33 // So epic. |
35 STATUS_FAIL, | 34 STATUS_FAIL, |
36 // Profile created but before initializing extensions and promo resources. | 35 // Profile created but before initializing extensions and promo resources. |
37 STATUS_CREATED, | 36 STATUS_CREATED, |
38 // Profile is created, extensions and promo resources are initialized. | 37 // Profile is created, extensions and promo resources are initialized. |
39 STATUS_INITIALIZED | 38 STATUS_INITIALIZED |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 150 |
152 // Creates a new profile in the next available multiprofile directory. | 151 // Creates a new profile in the next available multiprofile directory. |
153 // Directories are named "profile_1", "profile_2", etc., in sequence of | 152 // Directories are named "profile_1", "profile_2", etc., in sequence of |
154 // creation. (Because directories can be removed, however, it may be the case | 153 // creation. (Because directories can be removed, however, it may be the case |
155 // that at some point the list of numbered profiles is not continuous.) | 154 // that at some point the list of numbered profiles is not continuous.) |
156 static void CreateMultiProfileAsync(); | 155 static void CreateMultiProfileAsync(); |
157 | 156 |
158 // Register multi-profile related preferences in Local State. | 157 // Register multi-profile related preferences in Local State. |
159 static void RegisterPrefs(PrefService* prefs); | 158 static void RegisterPrefs(PrefService* prefs); |
160 | 159 |
161 // Returns a ProfileInfoInterface object which can be used to get information | 160 // Returns a ProfileInfoCache object which can be used to get information |
162 // about profiles without having to load them from disk. | 161 // about profiles without having to load them from disk. |
163 virtual ProfileInfoInterface& GetProfileInfo(); | 162 ProfileInfoCache& GetProfileInfoCache(); |
164 | |
165 // Returns the ProfileInfoInterface as a mutable ProfileInfoCache. This should | |
166 // only be used when you need the full set of methods. Wherever possible use | |
167 // the ProfileInfoInterface. | |
168 virtual ProfileInfoCache& GetMutableProfileInfo(); | |
169 | 163 |
170 // Schedules the profile at the given path to be deleted on shutdown. | 164 // Schedules the profile at the given path to be deleted on shutdown. |
171 void ScheduleProfileForDeletion(const FilePath& profile_dir); | 165 void ScheduleProfileForDeletion(const FilePath& profile_dir); |
172 | 166 |
173 // Checks if multiple profiles is enabled. | 167 // Checks if multiple profiles is enabled. |
174 static bool IsMultipleProfilesEnabled(); | 168 static bool IsMultipleProfilesEnabled(); |
175 | 169 |
176 protected: | 170 protected: |
177 // Does final initial actions. | 171 // Does final initial actions. |
178 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); | 172 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 }; | 240 }; |
247 | 241 |
248 // Same as the ProfileManager, but doesn't initialize some services of the | 242 // Same as the ProfileManager, but doesn't initialize some services of the |
249 // profile. This one is useful in unittests. | 243 // profile. This one is useful in unittests. |
250 class ProfileManagerWithoutInit : public ProfileManager { | 244 class ProfileManagerWithoutInit : public ProfileManager { |
251 protected: | 245 protected: |
252 virtual void DoFinalInit(Profile*, bool) {} | 246 virtual void DoFinalInit(Profile*, bool) {} |
253 }; | 247 }; |
254 | 248 |
255 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 249 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |