| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/prefs/pref_service_factory.h" | 5 #include "components/prefs/pref_service_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "components/prefs/default_pref_store.h" | 9 #include "components/prefs/default_pref_store.h" |
| 10 #include "components/prefs/json_pref_store.h" | 10 #include "components/prefs/json_pref_store.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 user_prefs_(NULL), | 29 user_prefs_(NULL), |
| 30 recommended_prefs_(NULL), | 30 recommended_prefs_(NULL), |
| 31 read_error_callback_(base::Bind(&DoNothingHandleReadError)), | 31 read_error_callback_(base::Bind(&DoNothingHandleReadError)), |
| 32 async_(false) {} | 32 async_(false) {} |
| 33 | 33 |
| 34 PrefServiceFactory::~PrefServiceFactory() {} | 34 PrefServiceFactory::~PrefServiceFactory() {} |
| 35 | 35 |
| 36 void PrefServiceFactory::SetUserPrefsFile( | 36 void PrefServiceFactory::SetUserPrefsFile( |
| 37 const base::FilePath& prefs_file, | 37 const base::FilePath& prefs_file, |
| 38 base::SequencedTaskRunner* task_runner) { | 38 base::SequencedTaskRunner* task_runner) { |
| 39 user_prefs_ = new JsonPrefStore( | 39 user_prefs_ = |
| 40 prefs_file, task_runner, scoped_ptr<PrefFilter>()); | 40 new JsonPrefStore(prefs_file, task_runner, std::unique_ptr<PrefFilter>()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 scoped_ptr<PrefService> PrefServiceFactory::Create( | 43 std::unique_ptr<PrefService> PrefServiceFactory::Create( |
| 44 PrefRegistry* pref_registry) { | 44 PrefRegistry* pref_registry) { |
| 45 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | 45 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
| 46 scoped_ptr<PrefService> pref_service( | 46 std::unique_ptr<PrefService> pref_service(new PrefService( |
| 47 new PrefService(pref_notifier, | 47 pref_notifier, |
| 48 new PrefValueStore(managed_prefs_.get(), | 48 new PrefValueStore(managed_prefs_.get(), supervised_user_prefs_.get(), |
| 49 supervised_user_prefs_.get(), | 49 extension_prefs_.get(), command_line_prefs_.get(), |
| 50 extension_prefs_.get(), | 50 user_prefs_.get(), recommended_prefs_.get(), |
| 51 command_line_prefs_.get(), | 51 pref_registry->defaults().get(), pref_notifier), |
| 52 user_prefs_.get(), | 52 user_prefs_.get(), pref_registry, read_error_callback_, async_)); |
| 53 recommended_prefs_.get(), | |
| 54 pref_registry->defaults().get(), | |
| 55 pref_notifier), | |
| 56 user_prefs_.get(), | |
| 57 pref_registry, | |
| 58 read_error_callback_, | |
| 59 async_)); | |
| 60 return pref_service; | 53 return pref_service; |
| 61 } | 54 } |
| OLD | NEW |