| Index: services/preferences/public/cpp/pref_registry_serializer.cc
|
| diff --git a/services/preferences/public/cpp/pref_registry_serializer.cc b/services/preferences/public/cpp/pref_registry_serializer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b64e2c787d49fbdfec4890d91275e78fb7b7fe42
|
| --- /dev/null
|
| +++ b/services/preferences/public/cpp/pref_registry_serializer.cc
|
| @@ -0,0 +1,21 @@
|
| +// 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/pref_registry_serializer.h"
|
| +
|
| +#include "components/prefs/pref_registry.h"
|
| +
|
| +namespace prefs {
|
| +
|
| +mojom::PrefRegistryPtr SerializePrefRegistry(PrefRegistry& pref_registry) {
|
| + auto registry = mojom::PrefRegistry::New();
|
| + for (auto& pref : pref_registry) {
|
| + registry->registrations[pref.first] = mojom::PrefRegistration::New(
|
| + pref.second->CreateDeepCopy(),
|
| + pref_registry.GetRegistrationFlags(pref.first));
|
| + }
|
| + return registry;
|
| +}
|
| +
|
| +} // namespace prefs
|
|
|