Index: chrome/browser/prefs/pref_service_syncable_factory.cc |
diff --git a/chrome/browser/prefs/pref_service_syncable_builder.cc b/chrome/browser/prefs/pref_service_syncable_factory.cc |
similarity index 39% |
rename from chrome/browser/prefs/pref_service_syncable_builder.cc |
rename to chrome/browser/prefs/pref_service_syncable_factory.cc |
index 701be662623e1c9276e391a9734be73aaae9c460..a3b0814984db42a58fed1a7d580900d5d88c6ca2 100644 |
--- a/chrome/browser/prefs/pref_service_syncable_builder.cc |
+++ b/chrome/browser/prefs/pref_service_syncable_factory.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/prefs/pref_service_syncable_builder.h" |
+#include "chrome/browser/prefs/pref_service_syncable_factory.h" |
#include "base/debug/trace_event.h" |
#include "base/prefs/default_pref_store.h" |
@@ -20,56 +20,54 @@ |
#include "chrome/browser/policy/policy_types.h" |
#endif |
-PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() { |
+PrefServiceSyncableFactory::PrefServiceSyncableFactory() { |
} |
-PrefServiceSyncableBuilder::~PrefServiceSyncableBuilder() { |
+PrefServiceSyncableFactory::~PrefServiceSyncableFactory() { |
} |
#if defined(ENABLE_CONFIGURATION_POLICY) |
-PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithManagedPolicies( |
+void PrefServiceSyncableFactory::SetManagedPolicies( |
policy::PolicyService* service) { |
- WithManagedPrefs(new policy::ConfigurationPolicyPrefStore( |
- service, |
- g_browser_process->browser_policy_connector()->GetHandlerList(), |
- policy::POLICY_LEVEL_MANDATORY)); |
- return *this; |
+ set_managed_prefs( |
+ new policy::ConfigurationPolicyPrefStore( |
+ service, |
+ g_browser_process->browser_policy_connector()->GetHandlerList(), |
+ policy::POLICY_LEVEL_MANDATORY)); |
} |
-PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithRecommendedPolicies( |
+void PrefServiceSyncableFactory::SetRecommendedPolicies( |
policy::PolicyService* service) { |
- WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore( |
- service, |
- g_browser_process->browser_policy_connector()->GetHandlerList(), |
- policy::POLICY_LEVEL_RECOMMENDED)); |
- return *this; |
+ set_recommended_prefs( |
+ new policy::ConfigurationPolicyPrefStore( |
+ service, |
+ g_browser_process->browser_policy_connector()->GetHandlerList(), |
+ policy::POLICY_LEVEL_RECOMMENDED)); |
} |
#endif |
-PrefServiceSyncableBuilder& |
-PrefServiceSyncableBuilder::WithCommandLine(CommandLine* command_line) { |
- WithCommandLinePrefs(new CommandLinePrefStore(command_line)); |
- return *this; |
+void PrefServiceSyncableFactory::SetCommandLine(CommandLine* command_line) { |
+ set_command_line_prefs(new CommandLinePrefStore(command_line)); |
} |
-PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable( |
+scoped_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( |
user_prefs::PrefRegistrySyncable* pref_registry) { |
- TRACE_EVENT0("browser", "PrefServiceSyncableBuilder::CreateSyncable"); |
+ TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable"); |
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
- PrefServiceSyncable* pref_service = new PrefServiceSyncable( |
- pref_notifier, |
- new PrefValueStore(managed_prefs_.get(), |
- supervised_user_prefs_.get(), |
- extension_prefs_.get(), |
- command_line_prefs_.get(), |
- user_prefs_.get(), |
- recommended_prefs_.get(), |
- pref_registry->defaults().get(), |
- pref_notifier), |
- user_prefs_.get(), |
- pref_registry, |
- read_error_callback_, |
- async_); |
- ResetDefaultState(); |
- return pref_service; |
+ scoped_ptr<PrefServiceSyncable> pref_service( |
+ new PrefServiceSyncable( |
+ pref_notifier, |
+ new PrefValueStore(managed_prefs_.get(), |
+ supervised_user_prefs_.get(), |
+ extension_prefs_.get(), |
+ command_line_prefs_.get(), |
+ user_prefs_.get(), |
+ recommended_prefs_.get(), |
+ pref_registry->defaults().get(), |
+ pref_notifier), |
+ user_prefs_.get(), |
+ pref_registry, |
+ read_error_callback_, |
+ async_)); |
+ return pref_service.Pass(); |
} |