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

Side by Side Diff: services/preferences/public/cpp/pref_service_factory.h

Issue 2791903003: Pref service: have Mash and Chrome connect to the right pref stores (Closed)
Patch Set: ProfilePrefStoreManagerTest: explicit list stores to connect to Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This provides a way for any service to connect to the pref service to access 5 // This provides a way for any service to connect to the pref service to access
6 // the application's current preferences. 6 // the application's current preferences.
7 7
8 // Access is provided through a synchronous interface, exposed using the 8 // Access is provided through a synchronous interface, exposed using the
9 // |PrefService| class. 9 // |PrefService| class.
10 10
11 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_ 11 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_
12 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_ 12 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "components/prefs/pref_value_store.h"
17 #include "services/preferences/public/interfaces/preferences.mojom.h" 18 #include "services/preferences/public/interfaces/preferences.mojom.h"
18 19
19 class PrefRegistry; 20 class PrefRegistry;
20 class PrefService; 21 class PrefService;
21 22
22 namespace service_manager { 23 namespace service_manager {
23 class Connector; 24 class Connector;
24 } 25 }
25 26
26 namespace prefs { 27 namespace prefs {
27 28
28 // Note that |PrefService| might not be fully initialized yet and thus you need 29 // Note that |PrefService| might not be fully initialized yet and thus you need
29 // to call |AddPrefInitObserver| on it before using it. Passed |nullptr| on 30 // to call |AddPrefInitObserver| on it before using it. Passed |nullptr| on
30 // failure. 31 // failure.
31 using ConnectCallback = base::Callback<void(std::unique_ptr<::PrefService>)>; 32 using ConnectCallback = base::Callback<void(std::unique_ptr<::PrefService>)>;
32 33
33 // Create a |PrefService| object acting as a client library for the pref 34 // Create a |PrefService| object acting as a client library for the pref
34 // service, by connecting to the service using |connector|. Connecting is 35 // service, by connecting to the service using |connector|. Connecting is
35 // asynchronous and |callback| will be called when it has been established. All 36 // asynchronous and |callback| will be called when it has been established. All
36 // preferences that will be accessed need to be registered in |pref_registry| 37 // preferences that will be accessed need to be registered in |pref_registry|
37 // first. 38 // first.
38 void ConnectToPrefService(service_manager::Connector* connector, 39 void ConnectToPrefService(
39 scoped_refptr<PrefRegistry> pref_registry, 40 service_manager::Connector* connector,
40 ConnectCallback callback, 41 scoped_refptr<PrefRegistry> pref_registry,
41 base::StringPiece service_name = mojom::kServiceName); 42 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types,
43 ConnectCallback callback,
44 base::StringPiece service_name = mojom::kServiceName);
42 45
43 } // namespace prefs 46 } // namespace prefs
44 47
45 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_ 48 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_SERVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698