OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/preferences/persistent_pref_store_factory.h" |
| 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
| 10 #include "components/prefs/json_pref_store.h" |
| 11 #include "components/prefs/pref_filter.h" |
| 12 #include "services/preferences/persistent_pref_store_impl.h" |
| 13 |
| 14 namespace prefs { |
| 15 namespace { |
| 16 |
| 17 std::unique_ptr<PersistentPrefStoreImpl> CreateSimplePersistentPrefStore( |
| 18 mojom::SimplePersistentPrefStoreConfigurationPtr config, |
| 19 base::SequencedWorkerPool* worker_pool) { |
| 20 return base::MakeUnique<PersistentPrefStoreImpl>( |
| 21 new JsonPrefStore(config->pref_filename, |
| 22 JsonPrefStore::GetTaskRunnerForFile( |
| 23 config->pref_filename.DirName(), worker_pool), |
| 24 nullptr), |
| 25 nullptr); |
| 26 } |
| 27 |
| 28 } // namespace |
| 29 |
| 30 std::unique_ptr<PersistentPrefStoreImpl> CreatePersistentPrefStore( |
| 31 mojom::PersistentPrefStoreConfigurationPtr configuration, |
| 32 base::SequencedWorkerPool* worker_pool) { |
| 33 if (configuration->is_simple_configuration()) { |
| 34 return CreateSimplePersistentPrefStore( |
| 35 std::move(configuration->get_simple_configuration()), worker_pool); |
| 36 } |
| 37 NOTREACHED(); |
| 38 return nullptr; |
| 39 } |
| 40 |
| 41 } // namespace prefs |
OLD | NEW |