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

Side by Side Diff: chrome/browser/prefs/profile_pref_store_manager.cc

Issue 2791903003: Pref service: have Mash and Chrome connect to the right pref stores (Closed)
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/prefs/profile_pref_store_manager.h" 5 #include "chrome/browser/prefs/profile_pref_store_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/json/json_file_value_serializer.h" 12 #include "base/json/json_file_value_serializer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "chrome/browser/prefs/browser_prefs.h"
18 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_features.h" 20 #include "chrome/common/chrome_features.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 21 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "components/prefs/json_pref_store.h" 22 #include "components/prefs/json_pref_store.h"
22 #include "components/prefs/persistent_pref_store.h" 23 #include "components/prefs/persistent_pref_store.h"
23 #include "components/prefs/pref_registry_simple.h" 24 #include "components/prefs/pref_registry_simple.h"
24 #include "services/preferences/public/cpp/persistent_pref_store_client.h" 25 #include "services/preferences/public/cpp/persistent_pref_store_client.h"
25 #include "services/preferences/public/interfaces/preferences.mojom.h" 26 #include "services/preferences/public/interfaces/preferences.mojom.h"
26 #include "services/preferences/tracked/pref_hash_filter.h" 27 #include "services/preferences/tracked/pref_hash_filter.h"
27 #include "services/preferences/tracked/pref_hash_store_impl.h" 28 #include "services/preferences/tracked/pref_hash_store_impl.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( 111 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
111 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, 112 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
112 const base::Closure& on_reset_on_load, 113 const base::Closure& on_reset_on_load,
113 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate, 114 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate,
114 service_manager::Connector* connector, 115 service_manager::Connector* connector,
115 scoped_refptr<PrefRegistry> pref_registry) { 116 scoped_refptr<PrefRegistry> pref_registry) {
116 if (features::PrefServiceEnabled()) { 117 if (features::PrefServiceEnabled()) {
117 ConfigurePrefService(on_reset_on_load, connector); 118 ConfigurePrefService(on_reset_on_load, connector);
118 prefs::mojom::PrefStoreConnectorPtr pref_connector; 119 prefs::mojom::PrefStoreConnectorPtr pref_connector;
119 connector->BindInterface(prefs::mojom::kServiceName, &pref_connector); 120 connector->BindInterface(prefs::mojom::kServiceName, &pref_connector);
121 auto in_process_types_set = chrome::InProcessPrefStores();
122 std::vector<PrefValueStore::PrefStoreType> in_process_types;
Sam McNally 2017/04/03 10:09:31 in_process_types(in_process_types_set.begin(), in_
tibell 2017/04/04 04:05:59 Done.
123 std::copy(in_process_types_set.begin(), in_process_types_set.end(),
124 std::back_inserter(in_process_types));
120 return new prefs::PersistentPrefStoreClient(std::move(pref_connector), 125 return new prefs::PersistentPrefStoreClient(std::move(pref_connector),
121 std::move(pref_registry)); 126 std::move(pref_registry),
127 std::move(in_process_types));
122 } 128 }
123 if (!kPlatformSupportsPreferenceTracking) { 129 if (!kPlatformSupportsPreferenceTracking) {
124 return new JsonPrefStore(profile_path_.Append(chrome::kPreferencesFilename), 130 return new JsonPrefStore(profile_path_.Append(chrome::kPreferencesFilename),
125 io_task_runner.get(), 131 io_task_runner.get(),
126 std::unique_ptr<PrefFilter>()); 132 std::unique_ptr<PrefFilter>());
127 } 133 }
128 134
129 std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> 135 std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
130 unprotected_configuration; 136 unprotected_configuration;
131 std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> 137 std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 const base::Closure& on_reset_on_load, 249 const base::Closure& on_reset_on_load,
244 service_manager::Connector* connector) { 250 service_manager::Connector* connector) {
245 auto config = prefs::mojom::PersistentPrefStoreConfiguration::New(); 251 auto config = prefs::mojom::PersistentPrefStoreConfiguration::New();
246 config->set_simple_configuration( 252 config->set_simple_configuration(
247 prefs::mojom::SimplePersistentPrefStoreConfiguration::New( 253 prefs::mojom::SimplePersistentPrefStoreConfiguration::New(
248 profile_path_.Append(chrome::kPreferencesFilename))); 254 profile_path_.Append(chrome::kPreferencesFilename)));
249 prefs::mojom::PrefServiceControlPtr control; 255 prefs::mojom::PrefServiceControlPtr control;
250 connector->BindInterface(prefs::mojom::kServiceName, &control); 256 connector->BindInterface(prefs::mojom::kServiceName, &control);
251 control->Init(std::move(config)); 257 control->Init(std::move(config));
252 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698