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

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

Issue 2767743003: Pref service: Merge connectors and send a PrefRegistry in Connect(). (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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/prefs/profile_pref_store_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_features.h" 19 #include "chrome/common/chrome_features.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 20 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "components/prefs/json_pref_store.h" 21 #include "components/prefs/json_pref_store.h"
22 #include "components/prefs/persistent_pref_store.h" 22 #include "components/prefs/persistent_pref_store.h"
23 #include "components/prefs/pref_registry_simple.h" 23 #include "components/prefs/pref_registry_simple.h"
24 #include "components/user_prefs/tracked/pref_hash_store_impl.h" 24 #include "components/user_prefs/tracked/pref_hash_store_impl.h"
25 #include "components/user_prefs/tracked/segregated_pref_store.h" 25 #include "components/user_prefs/tracked/segregated_pref_store.h"
26 #include "components/user_prefs/tracked/tracked_preferences_migration.h" 26 #include "components/user_prefs/tracked/tracked_preferences_migration.h"
27 #include "services/preferences/public/cpp/persistent_pref_store_client.h"
28 #include "services/preferences/public/interfaces/preferences.mojom.h" 27 #include "services/preferences/public/interfaces/preferences.mojom.h"
29 #include "services/service_manager/public/cpp/connector.h" 28 #include "services/service_manager/public/cpp/connector.h"
30 29
31 #if defined(OS_WIN) 30 #if defined(OS_WIN)
32 #include "chrome/install_static/install_util.h" 31 #include "chrome/install_static/install_util.h"
33 #include "components/user_prefs/tracked/registry_hash_store_contents_win.h" 32 #include "components/user_prefs/tracked/registry_hash_store_contents_win.h"
34 #endif 33 #endif
35 34
36 namespace { 35 namespace {
37 36
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 102 }
104 #endif // OS_WIN 103 #endif // OS_WIN
105 104
106 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( 105 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
107 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, 106 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
108 const base::Closure& on_reset_on_load, 107 const base::Closure& on_reset_on_load,
109 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate, 108 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate,
110 service_manager::Connector* connector) { 109 service_manager::Connector* connector) {
111 if (base::FeatureList::IsEnabled(features::kPrefService)) { 110 if (base::FeatureList::IsEnabled(features::kPrefService)) {
112 ConfigurePrefService(on_reset_on_load, connector); 111 ConfigurePrefService(on_reset_on_load, connector);
113 prefs::mojom::PersistentPrefStoreConnectorPtr pref_connector; 112 return nullptr;
114 connector->BindInterface(prefs::mojom::kPrefStoreServiceName,
115 &pref_connector);
116 return new prefs::PersistentPrefStoreClient(std::move(pref_connector));
117 } 113 }
118 if (!kPlatformSupportsPreferenceTracking) { 114 if (!kPlatformSupportsPreferenceTracking) {
119 return new JsonPrefStore(profile_path_.Append(chrome::kPreferencesFilename), 115 return new JsonPrefStore(profile_path_.Append(chrome::kPreferencesFilename),
120 io_task_runner.get(), 116 io_task_runner.get(),
121 std::unique_ptr<PrefFilter>()); 117 std::unique_ptr<PrefFilter>());
122 } 118 }
123 119
124 std::vector<PrefHashFilter::TrackedPreferenceMetadata> 120 std::vector<PrefHashFilter::TrackedPreferenceMetadata>
125 unprotected_configuration; 121 unprotected_configuration;
126 std::vector<PrefHashFilter::TrackedPreferenceMetadata> 122 std::vector<PrefHashFilter::TrackedPreferenceMetadata>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const base::Closure& on_reset_on_load, 237 const base::Closure& on_reset_on_load,
242 service_manager::Connector* connector) { 238 service_manager::Connector* connector) {
243 auto config = prefs::mojom::PersistentPrefStoreConfiguration::New(); 239 auto config = prefs::mojom::PersistentPrefStoreConfiguration::New();
244 config->set_simple_configuration( 240 config->set_simple_configuration(
245 prefs::mojom::SimplePersistentPrefStoreConfiguration::New( 241 prefs::mojom::SimplePersistentPrefStoreConfiguration::New(
246 profile_path_.Append(chrome::kPreferencesFilename))); 242 profile_path_.Append(chrome::kPreferencesFilename)));
247 prefs::mojom::PrefServiceControlPtr control; 243 prefs::mojom::PrefServiceControlPtr control;
248 connector->BindInterface(prefs::mojom::kPrefStoreServiceName, &control); 244 connector->BindInterface(prefs::mojom::kPrefStoreServiceName, &control);
249 control->Init(std::move(config)); 245 control->Init(std::move(config));
250 } 246 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/profile_pref_store_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698