| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_PROFILE_MANAGER_H__ | 7 #ifndef CHROME_BROWSER_PROFILE_MANAGER_H__ |
| 8 #define CHROME_BROWSER_PROFILE_MANAGER_H__ | 8 #define CHROME_BROWSER_PROFILE_MANAGER_H__ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "app/system_monitor.h" |
| 14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 15 #include "base/file_path.h" | 16 #include "base/file_path.h" |
| 16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 17 #include "base/non_thread_safe.h" | 18 #include "base/non_thread_safe.h" |
| 18 #include "base/system_monitor.h" | |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/profile.h" | 20 #include "chrome/browser/profile.h" |
| 21 | 21 |
| 22 // This is a small storage class that simply represents some metadata about | 22 // This is a small storage class that simply represents some metadata about |
| 23 // profiles that are available in the current user data directory. | 23 // profiles that are available in the current user data directory. |
| 24 // These are cached in local state so profiles don't need to be scanned | 24 // These are cached in local state so profiles don't need to be scanned |
| 25 // for their metadata on every launch. | 25 // for their metadata on every launch. |
| 26 class AvailableProfile { | 26 class AvailableProfile { |
| 27 public: | 27 public: |
| 28 AvailableProfile(const std::wstring& name, | 28 AvailableProfile(const std::wstring& name, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 std::wstring name_; // User-visible profile name | 58 std::wstring name_; // User-visible profile name |
| 59 std::wstring id_; // Profile identifier | 59 std::wstring id_; // Profile identifier |
| 60 FilePath directory_; // Subdirectory containing profile (not full path) | 60 FilePath directory_; // Subdirectory containing profile (not full path) |
| 61 | 61 |
| 62 DISALLOW_EVIL_CONSTRUCTORS(AvailableProfile); | 62 DISALLOW_EVIL_CONSTRUCTORS(AvailableProfile); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class ProfileManager : public NonThreadSafe, | 65 class ProfileManager : public NonThreadSafe, |
| 66 public base::SystemMonitor::PowerObserver { | 66 public SystemMonitor::PowerObserver { |
| 67 public: | 67 public: |
| 68 ProfileManager(); | 68 ProfileManager(); |
| 69 virtual ~ProfileManager(); | 69 virtual ~ProfileManager(); |
| 70 | 70 |
| 71 // ProfileManager prefs are loaded as soon as the profile is created. | 71 // ProfileManager prefs are loaded as soon as the profile is created. |
| 72 static void RegisterUserPrefs(PrefService* prefs); | 72 static void RegisterUserPrefs(PrefService* prefs); |
| 73 | 73 |
| 74 // Invokes ShutdownSessionService() on all profiles. | 74 // Invokes ShutdownSessionService() on all profiles. |
| 75 static void ShutdownSessionServices(); | 75 static void ShutdownSessionServices(); |
| 76 | 76 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // We keep a simple vector of profiles rather than something fancier | 177 // We keep a simple vector of profiles rather than something fancier |
| 178 // because we expect there to be a small number of profiles active. | 178 // because we expect there to be a small number of profiles active. |
| 179 ProfileVector profiles_; | 179 ProfileVector profiles_; |
| 180 | 180 |
| 181 AvailableProfileVector available_profiles_; | 181 AvailableProfileVector available_profiles_; |
| 182 | 182 |
| 183 DISALLOW_EVIL_CONSTRUCTORS(ProfileManager); | 183 DISALLOW_EVIL_CONSTRUCTORS(ProfileManager); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 #endif // CHROME_BROWSER_PROFILE_MANAGER_H__ | 186 #endif // CHROME_BROWSER_PROFILE_MANAGER_H__ |
| OLD | NEW |