Index: services/preferences/public/cpp/pref_service_factory.h |
diff --git a/services/preferences/public/cpp/pref_service_factory.h b/services/preferences/public/cpp/pref_service_factory.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..acc88b9cb85b9fbd97abbe5abb333ff51eb06b87 |
--- /dev/null |
+++ b/services/preferences/public/cpp/pref_service_factory.h |
@@ -0,0 +1,43 @@ |
+// 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. |
+ |
+// This provides a way for any service to connect to the pref service to access |
+// the application's current preferences. |
+ |
+// Access is provided through a synchronous interface, exposed using the |
+// |PrefService| class. |
+ |
+#ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_ |
+#define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_ |
+ |
+#include <memory> |
+ |
+#include "base/callback.h" |
+ |
+class PrefRegistry; |
+class PrefService; |
+ |
+namespace service_manager { |
+class Connector; |
+} |
+ |
+namespace prefs { |
+ |
+// Note that |PrefService| might not be fully initialized yet and thus you need |
+// to call |AddPrefInitObserver| on it before using it. Passed |nullptr| on |
+// failure. |
+using CreateCallback = base::Callback<void(std::unique_ptr<::PrefService>)>; |
+ |
+// Create a |PrefService| object acting as a client library for the pref |
+// service, by connecting to the service using |connector|. Connecting is |
+// asynchronous and |callback| will be called when it has been established. All |
+// preferences that will be accessed need to be registered in |pref_registry| |
+// first. |
+void CreatePrefService(service_manager::Connector* connector, |
Sam McNally
2017/03/22 04:34:03
This clashes with the CreatePrefService that creat
tibell
2017/03/22 05:32:04
Done.
|
+ scoped_refptr<PrefRegistry> pref_registry, |
+ const CreateCallback& callback); |
+ |
+} // namespace prefs |
+ |
+#endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_ |