summaryrefslogtreecommitdiffstats
path: root/chrome/common/pref_service.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 00:05:25 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 00:05:25 +0000
commitb9636005dd6f235dfb4fa4ea3a83df284341667d (patch)
treebb1fb84ce9727881ecb5899f87e3833d7f5c4437 /chrome/common/pref_service.h
parentc6ba2ce4faac672e685ee3ac3765c818cbe4dc90 (diff)
downloadchromium_src-b9636005dd6f235dfb4fa4ea3a83df284341667d.zip
chromium_src-b9636005dd6f235dfb4fa4ea3a83df284341667d.tar.gz
chromium_src-b9636005dd6f235dfb4fa4ea3a83df284341667d.tar.bz2
Add FilePath setter/getter to pref service. Change callers to use it rather than the string methods.
Update the pref service unit test and enable it on linux. Also switch over some wstrings to filepaths where appropriate. BUG=8154 Review URL: http://codereview.chromium.org/27354 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/pref_service.h')
-rw-r--r--chrome/common/pref_service.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/common/pref_service.h b/chrome/common/pref_service.h
index 8cc375f..0a7690c 100644
--- a/chrome/common/pref_service.h
+++ b/chrome/common/pref_service.h
@@ -17,6 +17,7 @@
#include <set>
+#include "base/file_path.h"
#include "base/hash_tables.h"
#include "base/non_thread_safe.h"
#include "base/observer_list.h"
@@ -76,7 +77,7 @@ class PrefService : public NonThreadSafe {
};
// |pref_filename| is the path to the prefs file we will try to load or save to.
- explicit PrefService(const std::wstring& pref_filename);
+ explicit PrefService(const FilePath& pref_filename);
~PrefService();
// Reloads the data from file. This should only be called when the importer
@@ -108,6 +109,8 @@ class PrefService : public NonThreadSafe {
double default_value);
void RegisterStringPref(const wchar_t* path,
const std::wstring& default_value);
+ void RegisterFilePathPref(const wchar_t* path,
+ const FilePath& default_value);
void RegisterListPref(const wchar_t* path);
void RegisterDictionaryPref(const wchar_t* path);
@@ -131,6 +134,7 @@ class PrefService : public NonThreadSafe {
int GetInteger(const wchar_t* path) const;
double GetReal(const wchar_t* path) const;
std::wstring GetString(const wchar_t* path) const;
+ FilePath GetFilePath(const wchar_t* path) const;
// Returns the branch if it exists. If it's not a branch or the branch does
// not exist, returns NULL. This does
@@ -150,6 +154,7 @@ class PrefService : public NonThreadSafe {
void SetInteger(const wchar_t* path, int value);
void SetReal(const wchar_t* path, double value);
void SetString(const wchar_t* path, const std::wstring& value);
+ void SetFilePath(const wchar_t* path, const FilePath& value);
// Used to set the value of dictionary or list values in the pref tree. This
// will create a dictionary or list if one does not exist in the pref tree.
@@ -196,7 +201,7 @@ class PrefService : public NonThreadSafe {
PrefService();
// Reads the data from the given file, returning true on success.
- bool LoadPersistentPrefs(const std::wstring& file_path);
+ bool LoadPersistentPrefs(const FilePath& file_path);
// Add a preference to the PreferenceMap. If the pref already exists, return
// false. This method takes ownership of |pref|.
@@ -218,7 +223,7 @@ class PrefService : public NonThreadSafe {
scoped_ptr<DictionaryValue> transient_;
// The filename that we're loading/saving the prefs to.
- std::wstring pref_filename_;
+ FilePath pref_filename_;
// Task used by ScheduleSavePersistentPrefs to avoid lots of little saves.
ScopedRunnableMethodFactory<PrefService> save_preferences_factory_;