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

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

Issue 1343743002: Remove dependency of PrefSyncableServiceFactory on //chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_service_syncable
Patch Set: Rebase Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_pref_service_factory.h" 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "components/user_prefs/tracked/pref_names.h" 47 #include "components/user_prefs/tracked/pref_names.h"
48 #include "content/public/browser/browser_context.h" 48 #include "content/public/browser/browser_context.h"
49 #include "content/public/browser/browser_thread.h" 49 #include "content/public/browser/browser_thread.h"
50 #include "grit/browser_resources.h" 50 #include "grit/browser_resources.h"
51 #include "sync/internal_api/public/base/model_type.h" 51 #include "sync/internal_api/public/base/model_type.h"
52 #include "ui/base/resource/resource_bundle.h" 52 #include "ui/base/resource/resource_bundle.h"
53 53
54 #if defined(ENABLE_CONFIGURATION_POLICY) 54 #if defined(ENABLE_CONFIGURATION_POLICY)
55 #include "components/policy/core/browser/browser_policy_connector.h" 55 #include "components/policy/core/browser/browser_policy_connector.h"
56 #include "components/policy/core/browser/configuration_policy_pref_store.h" 56 #include "components/policy/core/browser/configuration_policy_pref_store.h"
57 #include "components/policy/core/common/policy_types.h"
58 #endif 57 #endif
59 58
60 #if defined(ENABLE_EXTENSIONS) 59 #if defined(ENABLE_EXTENSIONS)
61 #include "extensions/browser/pref_names.h" 60 #include "extensions/browser/pref_names.h"
62 #endif 61 #endif
63 62
64 #if defined(ENABLE_SUPERVISED_USERS) 63 #if defined(ENABLE_SUPERVISED_USERS)
65 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 64 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
66 #endif 65 #endif
67 66
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 419 }
421 420
422 void PrepareFactory( 421 void PrepareFactory(
423 PrefServiceSyncableFactory* factory, 422 PrefServiceSyncableFactory* factory,
424 policy::PolicyService* policy_service, 423 policy::PolicyService* policy_service,
425 SupervisedUserSettingsService* supervised_user_settings, 424 SupervisedUserSettingsService* supervised_user_settings,
426 scoped_refptr<PersistentPrefStore> user_pref_store, 425 scoped_refptr<PersistentPrefStore> user_pref_store,
427 const scoped_refptr<PrefStore>& extension_prefs, 426 const scoped_refptr<PrefStore>& extension_prefs,
428 bool async) { 427 bool async) {
429 #if defined(ENABLE_CONFIGURATION_POLICY) 428 #if defined(ENABLE_CONFIGURATION_POLICY)
430 using policy::ConfigurationPolicyPrefStore; 429 policy::BrowserPolicyConnector* policy_connector =
431 factory->set_managed_prefs( 430 g_browser_process->browser_policy_connector();
432 make_scoped_refptr(new ConfigurationPolicyPrefStore( 431 factory->SetManagedPolicies(policy_service, policy_connector);
433 policy_service, 432 factory->SetRecommendedPolicies(policy_service, policy_connector);
434 g_browser_process->browser_policy_connector()->GetHandlerList(),
435 policy::POLICY_LEVEL_MANDATORY)));
436 factory->set_recommended_prefs(
437 make_scoped_refptr(new ConfigurationPolicyPrefStore(
438 policy_service,
439 g_browser_process->browser_policy_connector()->GetHandlerList(),
440 policy::POLICY_LEVEL_RECOMMENDED)));
441 #endif // ENABLE_CONFIGURATION_POLICY 433 #endif // ENABLE_CONFIGURATION_POLICY
442 434
443 #if defined(ENABLE_SUPERVISED_USERS) 435 #if defined(ENABLE_SUPERVISED_USERS)
444 if (supervised_user_settings) { 436 if (supervised_user_settings) {
445 scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr( 437 scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr(
446 new SupervisedUserPrefStore(supervised_user_settings)); 438 new SupervisedUserPrefStore(supervised_user_settings));
447 // TODO(bauerb): Temporary CHECK while investigating 439 // TODO(bauerb): Temporary CHECK while investigating
448 // https://crbug.com/425785. Remove when that bug is fixed. 440 // https://crbug.com/425785. Remove when that bug is fixed.
449 CHECK(async || supervised_user_prefs->IsInitializationComplete()); 441 CHECK(async || supervised_user_prefs->IsInitializationComplete());
450 factory->set_supervised_user_prefs(supervised_user_prefs); 442 factory->set_supervised_user_prefs(supervised_user_prefs);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 565
574 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 566 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
575 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 567 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
576 } 568 }
577 569
578 void RegisterPrefs(PrefRegistrySimple* registry) { 570 void RegisterPrefs(PrefRegistrySimple* registry) {
579 ProfilePrefStoreManager::RegisterPrefs(registry); 571 ProfilePrefStoreManager::RegisterPrefs(registry);
580 } 572 }
581 573
582 } // namespace chrome_prefs 574 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698