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

Unified Diff: chrome/browser/prefs/pref_service_syncable_factory.cc

Issue 64193003: Clean up PrefServiceBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory ownership bug in ProxyPolicyTest Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/pref_service_syncable_factory.h ('k') | chrome/browser/prefs/proxy_policy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/prefs/pref_service_syncable_factory.h ('k') | chrome/browser/prefs/proxy_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698