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

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

Issue 2719833002: Convert TrackedPreferenceValidationDelegate into a mojo interface. (Closed)
Patch Set: 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/tracked_preference_validation_delegate_struct_traits.cc
diff --git a/services/preferences/public/cpp/tracked_preference_validation_delegate_struct_traits.cc b/services/preferences/public/cpp/tracked_preference_validation_delegate_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dcc81211b9101787c27bac29ffe8d207836e95d3
--- /dev/null
+++ b/services/preferences/public/cpp/tracked_preference_validation_delegate_struct_traits.cc
@@ -0,0 +1,69 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/preferences/public/cpp/tracked_preference_validation_delegate_struct_traits.h"
+
+namespace mojo {
+
+using MojomValueState =
+ prefs::mojom::TrackedPreferenceValidationDelegate_ValueState;
+
+MojomValueState
+EnumTraits<MojomValueState, ::PrefHashStoreTransaction::ValueState>::ToMojom(
+ PrefHashStoreTransaction::ValueState input) {
+ switch (input) {
+ case PrefHashStoreTransaction::UNCHANGED:
+ return MojomValueState::UNCHANGED;
+ case PrefHashStoreTransaction::CLEARED:
+ return MojomValueState::CLEARED;
+ case PrefHashStoreTransaction::SECURE_LEGACY:
+ return MojomValueState::SECURE_LEGACY;
+ case PrefHashStoreTransaction::CHANGED:
+ return MojomValueState::CHANGED;
+ case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE:
+ return MojomValueState::UNTRUSTED_UNKNOWN_VALUE;
+ case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
+ return MojomValueState::TRUSTED_UNKNOWN_VALUE;
+ case PrefHashStoreTransaction::TRUSTED_NULL_VALUE:
+ return MojomValueState::TRUSTED_NULL_VALUE;
+ case PrefHashStoreTransaction::UNSUPPORTED:
+ return MojomValueState::UNSUPPORTED;
+ }
+ NOTREACHED();
+ return {};
+}
+
+bool EnumTraits<MojomValueState, ::PrefHashStoreTransaction::ValueState>::
+ FromMojom(MojomValueState input,
+ PrefHashStoreTransaction::ValueState* output) {
+ switch (input) {
+ case MojomValueState::UNCHANGED:
+ *output = PrefHashStoreTransaction::UNCHANGED;
+ return true;
+ case MojomValueState::CLEARED:
+ *output = PrefHashStoreTransaction::CLEARED;
+ return true;
+ case MojomValueState::SECURE_LEGACY:
+ *output = PrefHashStoreTransaction::SECURE_LEGACY;
+ return true;
+ case MojomValueState::CHANGED:
+ *output = PrefHashStoreTransaction::CHANGED;
+ return true;
+ case MojomValueState::UNTRUSTED_UNKNOWN_VALUE:
+ *output = PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE;
+ return true;
+ case MojomValueState::TRUSTED_UNKNOWN_VALUE:
+ *output = PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE;
+ return true;
+ case MojomValueState::TRUSTED_NULL_VALUE:
+ *output = PrefHashStoreTransaction::TRUSTED_NULL_VALUE;
+ return true;
+ case MojomValueState::UNSUPPORTED:
+ *output = PrefHashStoreTransaction::UNSUPPORTED;
+ return true;
+ }
+ return false;
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698