| 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; |
| 29 | 30 |
| 30 class ProfileManagerObserver { | 31 class ProfileManagerObserver { |
| 31 public: | 32 public: |
| 32 enum Status { | 33 enum Status { |
| 33 // So epic. | 34 // So epic. |
| 34 STATUS_FAIL, | 35 STATUS_FAIL, |
| 35 // Profile created but before initializing extensions and promo resources. | 36 // Profile created but before initializing extensions and promo resources. |
| 36 STATUS_CREATED, | 37 STATUS_CREATED, |
| 37 // Profile is created, extensions and promo resources are initialized. | 38 // Profile is created, extensions and promo resources are initialized. |
| 38 STATUS_INITIALIZED | 39 STATUS_INITIALIZED |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 151 |
| 151 // Creates a new profile in the next available multiprofile directory. | 152 // Creates a new profile in the next available multiprofile directory. |
| 152 // Directories are named "profile_1", "profile_2", etc., in sequence of | 153 // Directories are named "profile_1", "profile_2", etc., in sequence of |
| 153 // creation. (Because directories can be removed, however, it may be the case | 154 // creation. (Because directories can be removed, however, it may be the case |
| 154 // that at some point the list of numbered profiles is not continuous.) | 155 // that at some point the list of numbered profiles is not continuous.) |
| 155 static void CreateMultiProfileAsync(); | 156 static void CreateMultiProfileAsync(); |
| 156 | 157 |
| 157 // Register multi-profile related preferences in Local State. | 158 // Register multi-profile related preferences in Local State. |
| 158 static void RegisterPrefs(PrefService* prefs); | 159 static void RegisterPrefs(PrefService* prefs); |
| 159 | 160 |
| 160 // Returns a ProfileInfoCache object which can be used to get information | 161 // Returns a ProfileInfoInterface object which can be used to get information |
| 161 // about profiles without having to load them from disk. | 162 // about profiles without having to load them from disk. |
| 162 ProfileInfoCache& GetProfileInfoCache(); | 163 virtual ProfileInfoInterface& GetProfileInfo(); |
| 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(); |
| 163 | 169 |
| 164 // Schedules the profile at the given path to be deleted on shutdown. | 170 // Schedules the profile at the given path to be deleted on shutdown. |
| 165 void ScheduleProfileForDeletion(const FilePath& profile_dir); | 171 void ScheduleProfileForDeletion(const FilePath& profile_dir); |
| 166 | 172 |
| 167 // Checks if multiple profiles is enabled. | 173 // Checks if multiple profiles is enabled. |
| 168 static bool IsMultipleProfilesEnabled(); | 174 static bool IsMultipleProfilesEnabled(); |
| 169 | 175 |
| 170 protected: | 176 protected: |
| 171 // Does final initial actions. | 177 // Does final initial actions. |
| 172 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); | 178 virtual void DoFinalInit(Profile* profile, bool go_off_the_record); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 }; | 246 }; |
| 241 | 247 |
| 242 // Same as the ProfileManager, but doesn't initialize some services of the | 248 // Same as the ProfileManager, but doesn't initialize some services of the |
| 243 // profile. This one is useful in unittests. | 249 // profile. This one is useful in unittests. |
| 244 class ProfileManagerWithoutInit : public ProfileManager { | 250 class ProfileManagerWithoutInit : public ProfileManager { |
| 245 protected: | 251 protected: |
| 246 virtual void DoFinalInit(Profile*, bool) {} | 252 virtual void DoFinalInit(Profile*, bool) {} |
| 247 }; | 253 }; |
| 248 | 254 |
| 249 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 255 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |