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 <list> | 10 #include <list> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.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/profiles/profile_shortcut_manager.h" | 22 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
23 #include "chrome/browser/ui/browser_list_observer.h" | 23 #include "chrome/browser/ui/browser_list_observer.h" |
24 #include "chrome/browser/ui/host_desktop.h" | 24 #include "chrome/browser/ui/host_desktop.h" |
25 #include "chrome/browser/ui/startup/startup_types.h" | 25 #include "chrome/browser/ui/startup/startup_types.h" |
26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
28 | 28 |
| 29 class CommandLine; |
29 class NewProfileLauncher; | 30 class NewProfileLauncher; |
30 class ProfileInfoCache; | 31 class ProfileInfoCache; |
31 | 32 |
32 class ProfileManager : public base::NonThreadSafe, | 33 class ProfileManager : public base::NonThreadSafe, |
33 public content::NotificationObserver, | 34 public content::NotificationObserver, |
34 public Profile::Delegate { | 35 public Profile::Delegate { |
35 public: | 36 public: |
36 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; | 37 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; |
37 | 38 |
38 explicit ProfileManager(const FilePath& user_data_dir); | 39 explicit ProfileManager(const FilePath& user_data_dir); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 112 |
112 // Returns created profiles. Note, profiles order is NOT guaranteed to be | 113 // Returns created profiles. Note, profiles order is NOT guaranteed to be |
113 // related with the creation order. | 114 // related with the creation order. |
114 std::vector<Profile*> GetLoadedProfiles() const; | 115 std::vector<Profile*> GetLoadedProfiles() const; |
115 | 116 |
116 // content::NotificationObserver implementation. | 117 // content::NotificationObserver implementation. |
117 virtual void Observe(int type, | 118 virtual void Observe(int type, |
118 const content::NotificationSource& source, | 119 const content::NotificationSource& source, |
119 const content::NotificationDetails& details) OVERRIDE; | 120 const content::NotificationDetails& details) OVERRIDE; |
120 | 121 |
| 122 // Returns true if the given command line indicates that this is a short-lived |
| 123 // profile import process. |
| 124 static bool IsImportProcess(const CommandLine& command_line); |
| 125 |
| 126 // Whether a first-run import was triggered before the browser mainloop began. |
| 127 // This is used in testing to verify import startup actions that occur before |
| 128 // an observer can be registered in the test. |
| 129 static bool DidPerformProfileImport(); |
| 130 |
121 // Indicate that an import process will run for the next created Profile. | 131 // Indicate that an import process will run for the next created Profile. |
122 void SetWillImport(); | 132 void SetWillImport(); |
123 bool will_import() { return will_import_; } | 133 bool will_import() { return will_import_; } |
124 | 134 |
125 // Indicate that the import process for |profile| has completed. | 135 // Indicate that the import process for |profile| has completed. |
126 void OnImportFinished(Profile* profile); | 136 void OnImportFinished(Profile* profile); |
127 | 137 |
128 // ------------------ static utility functions ------------------- | 138 // ------------------ static utility functions ------------------- |
129 | 139 |
130 // Returns the path to the default profile directory, based on the given | 140 // Returns the path to the default profile directory, based on the given |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 class ProfileManagerWithoutInit : public ProfileManager { | 351 class ProfileManagerWithoutInit : public ProfileManager { |
342 public: | 352 public: |
343 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); | 353 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); |
344 | 354 |
345 protected: | 355 protected: |
346 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 356 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
347 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 357 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
348 }; | 358 }; |
349 | 359 |
350 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 360 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |