Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/prefs/default_pref_store.h" | 12 #include "base/prefs/default_pref_store.h" |
| 13 #include "base/prefs/json_pref_store.h" | 13 #include "base/prefs/json_pref_store.h" |
| 14 #include "base/prefs/pref_notifier_impl.h" | 14 #include "base/prefs/pref_notifier_impl.h" |
| 15 #include "base/prefs/pref_registry.h" | 15 #include "base/prefs/pref_registry.h" |
| 16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "base/prefs/pref_value_store.h" | 17 #include "base/prefs/pref_value_store.h" |
| 18 #include "chrome/browser/browser_process.h" | |
| 19 #include "chrome/browser/policy/browser_policy_connector.h" | |
| 18 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 20 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 19 #include "chrome/browser/prefs/command_line_pref_store.h" | 21 #include "chrome/browser/prefs/command_line_pref_store.h" |
| 20 #include "chrome/browser/prefs/pref_model_associator.h" | 22 #include "chrome/browser/prefs/pref_model_associator.h" |
| 21 #include "chrome/browser/prefs/pref_service_syncable_builder.h" | 23 #include "chrome/browser/prefs/pref_service_syncable_builder.h" |
| 22 #include "chrome/browser/ui/profile_error_dialog.h" | 24 #include "chrome/browser/ui/profile_error_dialog.h" |
| 23 #include "components/user_prefs/pref_registry_syncable.h" | 25 #include "components/user_prefs/pref_registry_syncable.h" |
| 24 #include "content/public/browser/browser_context.h" | 26 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| 26 #include "grit/chromium_strings.h" | 28 #include "grit/chromium_strings.h" |
| 27 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 file_util::FileSystemType fstype; | 70 file_util::FileSystemType fstype; |
| 69 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) { | 71 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) { |
| 70 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType", | 72 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType", |
| 71 static_cast<int>(fstype), | 73 static_cast<int>(fstype), |
| 72 file_util::FILE_SYSTEM_TYPE_COUNT); | 74 file_util::FILE_SYSTEM_TYPE_COUNT); |
| 73 } | 75 } |
| 74 #endif | 76 #endif |
| 75 | 77 |
| 76 #if defined(ENABLE_CONFIGURATION_POLICY) | 78 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 77 using policy::ConfigurationPolicyPrefStore; | 79 using policy::ConfigurationPolicyPrefStore; |
| 78 builder->WithManagedPrefs( | 80 builder->WithManagedPrefs(new ConfigurationPolicyPrefStore( |
| 79 ConfigurationPolicyPrefStore::CreateMandatoryPolicyPrefStore( | 81 policy_service, |
| 80 policy_service)); | 82 g_browser_process->browser_policy_connector()->GetHandlerList(), |
| 81 builder->WithRecommendedPrefs( | 83 policy::POLICY_LEVEL_MANDATORY)); |
|
bartfab (slow)
2013/08/12 13:27:53
Nit: #include "chrome/browser/policy/policy_types.
Joao da Silva
2013/08/12 15:41:55
Done.
| |
| 82 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore( | 84 builder->WithRecommendedPrefs(new ConfigurationPolicyPrefStore( |
| 83 policy_service)); | 85 policy_service, |
| 86 g_browser_process->browser_policy_connector()->GetHandlerList(), | |
| 87 policy::POLICY_LEVEL_RECOMMENDED)); | |
| 84 #endif // ENABLE_CONFIGURATION_POLICY | 88 #endif // ENABLE_CONFIGURATION_POLICY |
| 85 | 89 |
| 86 builder->WithAsync(async); | 90 builder->WithAsync(async); |
| 87 builder->WithExtensionPrefs(extension_prefs.get()); | 91 builder->WithExtensionPrefs(extension_prefs.get()); |
| 88 builder->WithCommandLinePrefs( | 92 builder->WithCommandLinePrefs( |
| 89 new CommandLinePrefStore(CommandLine::ForCurrentProcess())); | 93 new CommandLinePrefStore(CommandLine::ForCurrentProcess())); |
| 90 builder->WithReadErrorCallback(base::Bind(&HandleReadError)); | 94 builder->WithReadErrorCallback(base::Bind(&HandleReadError)); |
| 91 builder->WithUserPrefs(new JsonPrefStore(pref_filename, pref_io_task_runner)); | 95 builder->WithUserPrefs(new JsonPrefStore(pref_filename, pref_io_task_runner)); |
| 92 } | 96 } |
| 93 | 97 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 124 PrepareBuilder(&builder, | 128 PrepareBuilder(&builder, |
| 125 pref_filename, | 129 pref_filename, |
| 126 pref_io_task_runner, | 130 pref_io_task_runner, |
| 127 policy_service, | 131 policy_service, |
| 128 extension_prefs, | 132 extension_prefs, |
| 129 async); | 133 async); |
| 130 return builder.CreateSyncable(pref_registry.get()); | 134 return builder.CreateSyncable(pref_registry.get()); |
| 131 } | 135 } |
| 132 | 136 |
| 133 } // namespace chrome_prefs | 137 } // namespace chrome_prefs |
| OLD | NEW |