diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-30 21:18:51 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-30 21:18:51 +0000 |
commit | 9acc48601ea4aff4e5ec977c0dd089e887ba5ffd (patch) | |
tree | 9c0ef6715ab756b6c8eafb5f4385eaab73a3a8ab /chrome/browser/profile_manager.h | |
parent | 8d7690b29c0572c62bbe72817ac3b5195bf38e42 (diff) | |
download | chromium_src-9acc48601ea4aff4e5ec977c0dd089e887ba5ffd.zip chromium_src-9acc48601ea4aff4e5ec977c0dd089e887ba5ffd.tar.gz chromium_src-9acc48601ea4aff4e5ec977c0dd089e887ba5ffd.tar.bz2 |
Add -profile command line switch
Review URL: http://codereview.chromium.org/384062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile_manager.h')
-rw-r--r-- | chrome/browser/profile_manager.h | 82 |
1 files changed, 22 insertions, 60 deletions
diff --git a/chrome/browser/profile_manager.h b/chrome/browser/profile_manager.h index b52c7db..b27f47c 100644 --- a/chrome/browser/profile_manager.h +++ b/chrome/browser/profile_manager.h @@ -68,49 +68,19 @@ class ProfileManager : public NonThreadSafe, ProfileManager(); virtual ~ProfileManager(); - // ProfileManager prefs are loaded as soon as the profile is created. - static void RegisterUserPrefs(PrefService* prefs); - // Invokes ShutdownSessionService() on all profiles. static void ShutdownSessionServices(); // Returns the default profile. This adds the profile to the // ProfileManager if it doesn't already exist. This method returns NULL if // the profile doesn't exist and we can't create it. + // The profile used can be overridden by using --profile on Profile* GetDefaultProfile(const FilePath& user_data_dir); - // If a profile with the given path is currently managed by this object, - // return a pointer to the corresponding Profile object; - // otherwise return NULL. - Profile* GetProfileByPath(const FilePath& path) const; - - // If a profile with the given ID is currently managed by this object, - // return a pointer to the corresponding Profile object; - // otherwise returns NULL. - Profile* GetProfileByID(const std::wstring& id) const; - - // Adds a profile to the set of currently-loaded profiles. Returns a - // pointer to a Profile object corresponding to the given path. - Profile* AddProfileByPath(const FilePath& path); - - // Adds a profile to the set of currently-loaded profiles. Returns a - // pointer to a Profile object corresponding to the given profile ID. - // If no profile with the given ID is known, returns NULL. - Profile* AddProfileByID(const std::wstring& id); - - // Adds a pre-existing Profile object to the set managed by this - // ProfileManager. This ProfileManager takes ownership of the Profile. - // The Profile should not already be managed by this ProfileManager. - // Returns true if the profile was added, false otherwise. - bool AddProfile(Profile* profile); - - // Removes a profile from the set of currently-loaded profiles. The path must - // be exactly the same (including case) as when GetProfileByPath was called. - void RemoveProfileByPath(const FilePath& path); - - // Removes a profile from the set of currently-loaded profiles. - // (Does not delete the profile object.) - void RemoveProfile(Profile* profile); + // Returns a profile for a specific profile directory within the user data + // dir. This will return an existing profile it had already been created, + // otherwise it will create and manage it. + Profile* GetProfile(const FilePath& profile_dir); // These allow iteration through the current list of profiles. typedef std::vector<Profile*> ProfileVector; @@ -123,12 +93,6 @@ class ProfileManager : public NonThreadSafe, const_iterator end() const { return profiles_.end(); } typedef std::vector<AvailableProfile*> AvailableProfileVector; - const AvailableProfileVector& available_profiles() const { - return available_profiles_; - } - - // Creates a new window with the given profile. - void NewWindowWithProfile(Profile* profile); // PowerObserver notifications void OnSuspend(); @@ -139,36 +103,34 @@ class ProfileManager : public NonThreadSafe, // Returns the path to the profile directory based on the user data directory. static FilePath GetDefaultProfileDir(const FilePath& user_data_dir); - // Returns the path to the profile given the user profile directory. - static FilePath GetDefaultProfilePath(const FilePath& profile_dir); +// Returns the path to the preferences file given the user profile directory. + static FilePath GetProfilePrefsPath(const FilePath& profile_dir); // Tries to determine whether the given path represents a profile // directory, and returns true if it thinks it does. static bool IsProfile(const FilePath& path); - // Tries to copy profile data from the source path to the destination path, - // returning true if successful. - static bool CopyProfileData(const FilePath& source_path, - const FilePath& destination_path); + // If a profile with the given path is currently managed by this object, + // return a pointer to the corresponding Profile object; + // otherwise return NULL. + Profile* GetProfileByPath(const FilePath& path) const; - // Creates a new profile at the specified path with the given name and ID. - // |name| is the full-length human-readable name for the profile - // |nickname| is a shorter name for the profile--can be empty string + // Creates a new profile at the specified path. // This method should always return a valid Profile (i.e., should never // return NULL). - static Profile* CreateProfile(const FilePath& path, - const std::wstring& name, - const std::wstring& nickname, - const std::wstring& id); + static Profile* CreateProfile(const FilePath& path); + + // Adds a profile to the set of currently-loaded profiles. Returns a + // pointer to a Profile object corresponding to the given path. + Profile* AddProfileByPath(const FilePath& path); - // Returns the canonical form of the given ID string. - static std::wstring CanonicalizeID(const std::wstring& id); + // Adds a pre-existing Profile object to the set managed by this + // ProfileManager. This ProfileManager takes ownership of the Profile. + // The Profile should not already be managed by this ProfileManager. + // Returns true if the profile was added, false otherwise. + bool AddProfile(Profile* profile); private: - // Returns the AvailableProfile entry associated with the given ID, - // or NULL if no match is found. - AvailableProfile* GetAvailableProfileByID(const std::wstring& id); - // Hooks to suspend/resume per-profile network traffic. // These must be called on the IO thread. static void SuspendProfile(Profile*); |