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

Unified Diff: services/preferences/public/cpp/preferences_struct_traits.cc

Issue 2743563003: Pref service: add persistent pref store frontend and backend. (Closed)
Patch Set: rebase Created 3 years, 9 months 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: services/preferences/public/cpp/preferences_struct_traits.cc
diff --git a/services/preferences/public/cpp/preferences_struct_traits.cc b/services/preferences/public/cpp/preferences_struct_traits.cc
index 31b0dfb6c1ac9f9e86062b737ded6959ec6848cd..da124737a52d514c2bd9f30553121802f8d2f148 100644
--- a/services/preferences/public/cpp/preferences_struct_traits.cc
+++ b/services/preferences/public/cpp/preferences_struct_traits.cc
@@ -61,4 +61,76 @@ bool EnumTraits<PrefStoreType, PrefValueStore::PrefStoreType>::FromMojom(
return false;
}
+using MojomReadError = prefs::mojom::PersistentPrefStoreConnector_ReadError;
+
+MojomReadError
+EnumTraits<MojomReadError, PersistentPrefStore::PrefReadError>::ToMojom(
+ PersistentPrefStore::PrefReadError input) {
+ switch (input) {
+ case PersistentPrefStore::PREF_READ_ERROR_NONE:
+ return MojomReadError::NONE;
+ case PersistentPrefStore::PREF_READ_ERROR_JSON_PARSE:
+ return MojomReadError::JSON_PARSE;
+ case PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE:
+ return MojomReadError::JSON_TYPE;
+ case PersistentPrefStore::PREF_READ_ERROR_ACCESS_DENIED:
+ return MojomReadError::ACCESS_DENIED;
+ case PersistentPrefStore::PREF_READ_ERROR_FILE_OTHER:
+ return MojomReadError::FILE_OTHER;
+ case PersistentPrefStore::PREF_READ_ERROR_FILE_LOCKED:
+ return MojomReadError::FILE_LOCKED;
+ case PersistentPrefStore::PREF_READ_ERROR_NO_FILE:
+ return MojomReadError::NO_FILE;
+ case PersistentPrefStore::PREF_READ_ERROR_JSON_REPEAT:
+ return MojomReadError::JSON_REPEAT;
+ case PersistentPrefStore::PREF_READ_ERROR_FILE_NOT_SPECIFIED:
+ return MojomReadError::FILE_NOT_SPECIFIED;
+ case PersistentPrefStore::PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE:
+ return MojomReadError::ASYNCHRONOUS_TASK_INCOMPLETE;
+ case PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM:
+ break;
+ }
+ NOTREACHED();
+ return {};
+}
+
+bool EnumTraits<MojomReadError, PersistentPrefStore::PrefReadError>::FromMojom(
+ MojomReadError input,
+ PersistentPrefStore::PrefReadError* output) {
+ switch (input) {
+ case MojomReadError::NONE:
+ *output = PersistentPrefStore::PREF_READ_ERROR_NONE;
+ return true;
+ case MojomReadError::JSON_PARSE:
+ *output = PersistentPrefStore::PREF_READ_ERROR_JSON_PARSE;
+ return true;
+ case MojomReadError::JSON_TYPE:
+ *output = PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE;
+ return true;
+ case MojomReadError::ACCESS_DENIED:
+ *output = PersistentPrefStore::PREF_READ_ERROR_ACCESS_DENIED;
+ return true;
+ case MojomReadError::FILE_OTHER:
+ *output = PersistentPrefStore::PREF_READ_ERROR_FILE_OTHER;
+ return true;
+ case MojomReadError::FILE_LOCKED:
+ *output = PersistentPrefStore::PREF_READ_ERROR_FILE_LOCKED;
+ return true;
+ case MojomReadError::NO_FILE:
+ *output = PersistentPrefStore::PREF_READ_ERROR_NO_FILE;
+ return true;
+ case MojomReadError::JSON_REPEAT:
+ *output = PersistentPrefStore::PREF_READ_ERROR_JSON_REPEAT;
+ return true;
+ case MojomReadError::FILE_NOT_SPECIFIED:
+ *output = PersistentPrefStore::PREF_READ_ERROR_FILE_NOT_SPECIFIED;
+ return true;
+ case MojomReadError::ASYNCHRONOUS_TASK_INCOMPLETE:
+ *output =
+ PersistentPrefStore::PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE;
+ return true;
+ }
+ return false;
+}
+
} // namespace mojo
« no previous file with comments | « services/preferences/public/cpp/preferences_struct_traits.h ('k') | services/preferences/public/cpp/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698