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/system_monitor/system_monitor.h" | |
21 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
24 #include "content/common/notification_observer.h" | 23 #include "content/common/notification_observer.h" |
25 #include "content/common/notification_registrar.h" | 24 #include "content/common/notification_registrar.h" |
| 25 #include "ui/base/system_monitor/system_monitor.h" |
26 | 26 |
27 class FilePath; | 27 class FilePath; |
28 class NewProfileLauncher; | 28 class NewProfileLauncher; |
29 | 29 |
30 class ProfileManagerObserver { | 30 class ProfileManagerObserver { |
31 public: | 31 public: |
32 // This method is called when profile is ready. If profile creation has | 32 // This method is called when profile is ready. If profile creation has |
33 // failed, method is called with |profile| equal to NULL. | 33 // failed, method is called with |profile| equal to NULL. |
34 virtual void OnProfileCreated(Profile* profile) = 0; | 34 virtual void OnProfileCreated(Profile* profile) = 0; |
35 | 35 |
36 // If true, delete the observer after the profile has been created. Default | 36 // If true, delete the observer after the profile has been created. Default |
37 // is false. | 37 // is false. |
38 virtual bool DeleteAfterCreation(); | 38 virtual bool DeleteAfterCreation(); |
39 }; | 39 }; |
40 | 40 |
41 class ProfileManager : public base::NonThreadSafe, | 41 class ProfileManager : public base::NonThreadSafe, |
42 public base::SystemMonitor::PowerObserver, | 42 public ui::SystemMonitor::PowerObserver, |
43 public BrowserList::Observer, | 43 public BrowserList::Observer, |
44 public NotificationObserver, | 44 public NotificationObserver, |
45 public Profile::Delegate { | 45 public Profile::Delegate { |
46 public: | 46 public: |
47 ProfileManager(); | 47 ProfileManager(); |
48 virtual ~ProfileManager(); | 48 virtual ~ProfileManager(); |
49 | 49 |
50 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. | 50 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. |
51 static void ShutdownSessionServices(); | 51 static void ShutdownSessionServices(); |
52 | 52 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 }; | 195 }; |
196 | 196 |
197 // Same as the ProfileManager, but doesn't initialize some services of the | 197 // Same as the ProfileManager, but doesn't initialize some services of the |
198 // profile. This one is useful in unittests. | 198 // profile. This one is useful in unittests. |
199 class ProfileManagerWithoutInit : public ProfileManager { | 199 class ProfileManagerWithoutInit : public ProfileManager { |
200 protected: | 200 protected: |
201 virtual void DoFinalInit(Profile*) {} | 201 virtual void DoFinalInit(Profile*) {} |
202 }; | 202 }; |
203 | 203 |
204 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 204 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |