summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile_manager.h
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 21:54:32 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 21:54:32 +0000
commitf7011fcb7f28651953b1765b241c974e25c8cd40 (patch)
treef3a2c97bb98cc12aaca39bb27791998f026b58b7 /chrome/browser/profile_manager.h
parent4663213354a9c41ab0e5a785d52bf5c9a9692514 (diff)
downloadchromium_src-f7011fcb7f28651953b1765b241c974e25c8cd40.zip
chromium_src-f7011fcb7f28651953b1765b241c974e25c8cd40.tar.gz
chromium_src-f7011fcb7f28651953b1765b241c974e25c8cd40.tar.bz2
Porting profiles to the Mac.
Review URL: http://codereview.chromium.org/19623 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile_manager.h')
-rw-r--r--chrome/browser/profile_manager.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/chrome/browser/profile_manager.h b/chrome/browser/profile_manager.h
index 72f1d63..3735492 100644
--- a/chrome/browser/profile_manager.h
+++ b/chrome/browser/profile_manager.h
@@ -12,6 +12,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/non_thread_safe.h"
#include "base/system_monitor.h"
@@ -26,17 +27,18 @@ class AvailableProfile {
public:
AvailableProfile(const std::wstring& name,
const std::wstring& id,
- const std::wstring& directory)
+ const FilePath& directory)
: name_(name), id_(id), directory_(directory) {}
// Decodes a DictionaryValue into an AvailableProfile
static AvailableProfile* FromValue(DictionaryValue* value) {
DCHECK(value);
- std::wstring name, id, directory;
+ std::wstring name, id;
+ FilePath::StringType directory;
value->GetString(L"name", &name);
value->GetString(L"id", &id);
value->GetString(L"directory", &directory);
- return new AvailableProfile(name, id, directory);
+ return new AvailableProfile(name, id, FilePath(directory));
}
// Encodes this AvailableProfile into a new DictionaryValue
@@ -44,18 +46,18 @@ class AvailableProfile {
DictionaryValue* value = new DictionaryValue;
value->SetString(L"name", name_);
value->SetString(L"id", id_);
- value->SetString(L"directory", directory_);
+ value->SetString(L"directory", directory_.value());
return value;
}
std::wstring name() const { return name_; }
std::wstring id() const { return id_; }
- std::wstring directory() const { return directory_; }
+ FilePath directory() const { return directory_; }
private:
- std::wstring name_; // User-visible profile name
- std::wstring id_; // Profile identifier
- std::wstring directory_; // Subdirectory containing profile (not full path)
+ std::wstring name_; // User-visible profile name
+ std::wstring id_; // Profile identifier
+ FilePath directory_; // Subdirectory containing profile (not full path)
DISALLOW_EVIL_CONSTRUCTORS(AvailableProfile);
};
@@ -75,12 +77,12 @@ class ProfileManager : public NonThreadSafe,
// 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.
- Profile* GetDefaultProfile(const std::wstring& user_data_dir);
+ 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 std::wstring& path) const;
+ 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;
@@ -89,7 +91,7 @@ class ProfileManager : public NonThreadSafe,
// 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 std::wstring& 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.
@@ -104,7 +106,7 @@ class ProfileManager : public NonThreadSafe,
// 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 std::wstring& path);
+ void RemoveProfileByPath(const FilePath& path);
// Removes a profile from the set of currently-loaded profiles.
// (Does not delete the profile object.)
@@ -134,26 +136,26 @@ class ProfileManager : public NonThreadSafe,
// ------------------ static utility functions -------------------
// Returns the path to the profile directory based on the user data directory.
- static std::wstring GetDefaultProfileDir(const std::wstring& user_data_dir);
+ static FilePath GetDefaultProfileDir(const FilePath& user_data_dir);
// Returns the path to the profile given the user profile directory.
- static std::wstring GetDefaultProfilePath(const std::wstring& profile_dir);
+ static FilePath GetDefaultProfilePath(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 std::wstring& path);
+ 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 std::wstring& source_path,
- const std::wstring& destination_path);
+ static bool CopyProfileData(const FilePath& source_path,
+ const FilePath& destination_path);
// 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
// This method should always return a valid Profile (i.e., should never
// return NULL).
- static Profile* CreateProfile(const std::wstring& path,
+ static Profile* CreateProfile(const FilePath& path,
const std::wstring& name,
const std::wstring& nickname,
const std::wstring& id);