Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1150)

Unified Diff: chrome/service/service_process_prefs.cc

Issue 11365112: Change PrefStore::ReadResult to a boolean. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/service/service_process_prefs.cc
diff --git a/chrome/service/service_process_prefs.cc b/chrome/service/service_process_prefs.cc
index 811647dc525c32238714d7fe46c9e28a35fa1e23..c576a3eb2b38d161d5a89f2b1f7e8771a7d5cda1 100644
--- a/chrome/service/service_process_prefs.cc
+++ b/chrome/service/service_process_prefs.cc
@@ -27,10 +27,9 @@ std::string ServiceProcessPrefs::GetString(
const std::string& default_value) const {
const Value* value;
std::string result;
- if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
- !value->GetAsString(&result)) {
+ if (!prefs_->GetValue(key, &value) || !value->GetAsString(&result))
return default_value;
- }
+
return result;
}
@@ -43,10 +42,9 @@ bool ServiceProcessPrefs::GetBoolean(const std::string& key,
bool default_value) const {
const Value* value;
bool result = false;
- if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
- !value->GetAsBoolean(&result)) {
+ if (!prefs_->GetValue(key, &value) || !value->GetAsBoolean(&result))
return default_value;
- }
+
return result;
}
@@ -58,10 +56,9 @@ int ServiceProcessPrefs::GetInt(const std::string& key,
int default_value) const {
const Value* value;
int result = default_value;
- if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
- !value->GetAsInteger(&result)) {
+ if (!prefs_->GetValue(key, &value) || !value->GetAsInteger(&result))
return default_value;
- }
+
return result;
}
@@ -72,7 +69,7 @@ void ServiceProcessPrefs::SetInt(const std::string& key, int value) {
const DictionaryValue* ServiceProcessPrefs::GetDictionary(
const std::string& key) const {
const Value* value;
- if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
+ if (!prefs_->GetValue(key, &value) ||
!value->IsType(Value::TYPE_DICTIONARY)) {
return NULL;
}
@@ -83,10 +80,8 @@ const DictionaryValue* ServiceProcessPrefs::GetDictionary(
const base::ListValue* ServiceProcessPrefs::GetList(
const std::string& key) const {
const Value* value;
- if (prefs_->GetValue(key, &value) != PersistentPrefStore::READ_OK ||
- !value->IsType(Value::TYPE_LIST)) {
- return NULL;
- }
+ if (!prefs_->GetValue(key, &value) || !value->IsType(Value::TYPE_LIST))
+ return NULL;
return static_cast<const ListValue*>(value);
}

Powered by Google App Engine
This is Rietveld 408576698