Chromium Code Reviews| 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 static bool DidPerformProfileImport(); | |
|
Yoyo Zhou
2012/12/15 02:00:23
This looks like it's only used in tests; I would a
tapted
2012/12/17 05:40:39
Done.
| |
| 128 | |
| 121 // Indicate that an import process will run for the next created Profile. | 129 // Indicate that an import process will run for the next created Profile. |
| 122 void SetWillImport(); | 130 void SetWillImport(); |
| 123 bool will_import() { return will_import_; } | 131 bool will_import() { return will_import_; } |
| 124 | 132 |
| 125 // Indicate that the import process for |profile| has completed. | 133 // Indicate that the import process for |profile| has completed. |
| 126 void OnImportFinished(Profile* profile); | 134 void OnImportFinished(Profile* profile); |
| 127 | 135 |
| 128 // ------------------ static utility functions ------------------- | 136 // ------------------ static utility functions ------------------- |
| 129 | 137 |
| 130 // Returns the path to the default profile directory, based on the given | 138 // 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 { | 349 class ProfileManagerWithoutInit : public ProfileManager { |
| 342 public: | 350 public: |
| 343 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); | 351 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); |
| 344 | 352 |
| 345 protected: | 353 protected: |
| 346 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 354 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
| 347 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 355 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
| 348 }; | 356 }; |
| 349 | 357 |
| 350 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 358 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
| OLD | NEW |