diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-23 12:58:50 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-23 12:58:50 +0000 |
commit | 91ae7e3014fc0fec5e480399dac574b1a07f0fe0 (patch) | |
tree | 6e7e85ec98125363e1a0732de5b4c156732f67cf | |
parent | f4087b6581af7fe39ada3dbb2eb2ca5e6663ece9 (diff) | |
download | chromium_src-91ae7e3014fc0fec5e480399dac574b1a07f0fe0.zip chromium_src-91ae7e3014fc0fec5e480399dac574b1a07f0fe0.tar.gz chromium_src-91ae7e3014fc0fec5e480399dac574b1a07f0fe0.tar.bz2 |
Add API to find out whether a preference is managed.
Add a method |IsManaged()| to the |PrefStore::Preference| class that returns true if the preference cannot be set by the user. Because we currently don't actually implement managed preferences yet, the implementation always returns false.
BUG=40260
Review URL: http://codereview.chromium.org/1744002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45440 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/pref_service.cc | 24 | ||||
-rw-r--r-- | chrome/browser/pref_service.h | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc index 62f8340..2a608fb 100644 --- a/chrome/browser/pref_service.cc +++ b/chrome/browser/pref_service.cc @@ -458,6 +458,10 @@ void PrefService::SetBoolean(const wchar_t* path, bool value) { NOTREACHED() << "Trying to write an unregistered pref: " << path; return; } + if (pref->IsManaged()) { + NOTREACHED() << "Preference is managed: " << path; + return; + } if (pref->type() != Value::TYPE_BOOLEAN) { NOTREACHED() << "Wrong type for SetBoolean: " << path; return; @@ -477,6 +481,10 @@ void PrefService::SetInteger(const wchar_t* path, int value) { NOTREACHED() << "Trying to write an unregistered pref: " << path; return; } + if (pref->IsManaged()) { + NOTREACHED() << "Preference is managed: " << path; + return; + } if (pref->type() != Value::TYPE_INTEGER) { NOTREACHED() << "Wrong type for SetInteger: " << path; return; @@ -496,6 +504,10 @@ void PrefService::SetReal(const wchar_t* path, double value) { NOTREACHED() << "Trying to write an unregistered pref: " << path; return; } + if (pref->IsManaged()) { + NOTREACHED() << "Preference is managed: " << path; + return; + } if (pref->type() != Value::TYPE_REAL) { NOTREACHED() << "Wrong type for SetReal: " << path; return; @@ -515,6 +527,10 @@ void PrefService::SetString(const wchar_t* path, const std::wstring& value) { NOTREACHED() << "Trying to write an unregistered pref: " << path; return; } + if (pref->IsManaged()) { + NOTREACHED() << "Preference is managed: " << path; + return; + } if (pref->type() != Value::TYPE_STRING) { NOTREACHED() << "Wrong type for SetString: " << path; return; @@ -534,6 +550,10 @@ void PrefService::SetFilePath(const wchar_t* path, const FilePath& value) { NOTREACHED() << "Trying to write an unregistered pref: " << path; return; } + if (pref->IsManaged()) { + NOTREACHED() << "Preference is managed: " << path; + return; + } if (pref->type() != Value::TYPE_STRING) { NOTREACHED() << "Wrong type for SetFilePath: " << path; return; @@ -560,6 +580,10 @@ void PrefService::SetInt64(const wchar_t* path, int64 value) { NOTREACHED() << "Trying to write an unregistered pref: " << path; return; } + if (pref->IsManaged()) { + NOTREACHED() << "Preference is managed: " << path; + return; + } if (pref->type() != Value::TYPE_STRING) { NOTREACHED() << "Wrong type for SetInt64: " << path; return; diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h index 5b18d9d..584063f 100644 --- a/chrome/browser/pref_service.h +++ b/chrome/browser/pref_service.h @@ -51,6 +51,10 @@ class PrefService : public NonThreadSafe { // Returns true if the current value matches the default value. bool IsDefaultValue() const; + // Returns true if the Preference is managed, i.e. not changeable + // by the user. + bool IsManaged() const { return false; } + private: friend class PrefService; |