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 <stddef.h> | 10 #include <stddef.h> |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 #include <memory> | 13 #include <memory> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/linked_ptr.h" | 20 #include "base/memory/linked_ptr.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/threading/non_thread_safe.h" | 22 #include "base/threading/non_thread_safe.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/profiles/profile_metrics.h" | 25 #include "chrome/browser/profiles/profile_metrics.h" |
26 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 26 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
27 #include "chrome/browser/ui/browser_list_observer.h" | 27 #include "chrome/browser/ui/browser_list_observer.h" |
| 28 #include "chrome/common/features.h" |
28 #include "content/public/browser/notification_observer.h" | 29 #include "content/public/browser/notification_observer.h" |
29 #include "content/public/browser/notification_registrar.h" | 30 #include "content/public/browser/notification_registrar.h" |
30 | 31 |
31 class NewProfileLauncher; | 32 class NewProfileLauncher; |
32 class ProfileAttributesStorage; | 33 class ProfileAttributesStorage; |
33 class ProfileInfoCache; | 34 class ProfileInfoCache; |
34 | 35 |
35 class ProfileManager : public base::NonThreadSafe, | 36 class ProfileManager : public base::NonThreadSafe, |
36 public content::NotificationObserver, | 37 public content::NotificationObserver, |
37 public Profile::Delegate { | 38 public Profile::Delegate { |
38 public: | 39 public: |
39 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; | 40 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; |
40 typedef base::Callback<void(Profile*)> ProfileLoadedCallback; | 41 typedef base::Callback<void(Profile*)> ProfileLoadedCallback; |
41 | 42 |
42 explicit ProfileManager(const base::FilePath& user_data_dir); | 43 explicit ProfileManager(const base::FilePath& user_data_dir); |
43 ~ProfileManager() override; | 44 ~ProfileManager() override; |
44 | 45 |
45 #if defined(ENABLE_SESSION_SERVICE) | 46 #if BUILDFLAG(ENABLE_SESSION_SERVICE) |
46 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. | 47 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. |
47 static void ShutdownSessionServices(); | 48 static void ShutdownSessionServices(); |
48 #endif | 49 #endif |
49 | 50 |
50 // Physically remove deleted profile directories from disk. | 51 // Physically remove deleted profile directories from disk. |
51 static void NukeDeletedProfilesFromDisk(); | 52 static void NukeDeletedProfilesFromDisk(); |
52 | 53 |
53 // Same as instance method but provides the default user_data_dir as well. | 54 // Same as instance method but provides the default user_data_dir as well. |
54 // If the Profile is going to be used to open a new window then consider using | 55 // If the Profile is going to be used to open a new window then consider using |
55 // GetLastUsedProfileAllowedByPolicy() instead. | 56 // GetLastUsedProfileAllowedByPolicy() instead. |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 class ProfileManagerWithoutInit : public ProfileManager { | 427 class ProfileManagerWithoutInit : public ProfileManager { |
427 public: | 428 public: |
428 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 429 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
429 | 430 |
430 protected: | 431 protected: |
431 void DoFinalInitForServices(Profile*, bool) override {} | 432 void DoFinalInitForServices(Profile*, bool) override {} |
432 void DoFinalInitLogging(Profile*) override {} | 433 void DoFinalInitLogging(Profile*) override {} |
433 }; | 434 }; |
434 | 435 |
435 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 436 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |