| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pref_service.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 20); | 105 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 20); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 // static | 112 // static |
| 113 PrefService* PrefService::CreatePrefService(const FilePath& pref_filename, | 113 PrefService* PrefService::CreatePrefService(const FilePath& pref_filename, |
| 114 PrefStore* extension_prefs, | 114 PrefStore* extension_prefs, |
| 115 Profile* profile, | |
| 116 bool async) { | 115 bool async) { |
| 117 using policy::ConfigurationPolicyPrefStore; | 116 using policy::ConfigurationPolicyPrefStore; |
| 118 | 117 |
| 119 #if defined(OS_LINUX) | 118 #if defined(OS_LINUX) |
| 120 // We'd like to see what fraction of our users have the preferences | 119 // We'd like to see what fraction of our users have the preferences |
| 121 // stored on a network file system, as we've had no end of troubles | 120 // stored on a network file system, as we've had no end of troubles |
| 122 // with NFS/AFS. | 121 // with NFS/AFS. |
| 123 // TODO(evanm): remove this once we've collected state. | 122 // TODO(evanm): remove this once we've collected state. |
| 124 file_util::FileSystemType fstype; | 123 file_util::FileSystemType fstype; |
| 125 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) { | 124 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) { |
| 126 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType", | 125 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType", |
| 127 static_cast<int>(fstype), | 126 static_cast<int>(fstype), |
| 128 file_util::FILE_SYSTEM_TYPE_COUNT); | 127 file_util::FILE_SYSTEM_TYPE_COUNT); |
| 129 } | 128 } |
| 130 #endif | 129 #endif |
| 131 | 130 |
| 132 ConfigurationPolicyPrefStore* managed_platform = | 131 ConfigurationPolicyPrefStore* managed_platform = |
| 133 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore(); | 132 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore(); |
| 134 ConfigurationPolicyPrefStore* managed_cloud = | 133 ConfigurationPolicyPrefStore* managed_cloud = |
| 135 ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore(profile); | 134 ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore(); |
| 136 CommandLinePrefStore* command_line = | 135 CommandLinePrefStore* command_line = |
| 137 new CommandLinePrefStore(CommandLine::ForCurrentProcess()); | 136 new CommandLinePrefStore(CommandLine::ForCurrentProcess()); |
| 138 JsonPrefStore* user = new JsonPrefStore( | 137 JsonPrefStore* user = new JsonPrefStore( |
| 139 pref_filename, | 138 pref_filename, |
| 140 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 139 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 141 ConfigurationPolicyPrefStore* recommended_platform = | 140 ConfigurationPolicyPrefStore* recommended_platform = |
| 142 ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore(); | 141 ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore(); |
| 143 ConfigurationPolicyPrefStore* recommended_cloud = | 142 ConfigurationPolicyPrefStore* recommended_cloud = |
| 144 ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore( | 143 ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore(); |
| 145 profile); | |
| 146 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); | 144 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); |
| 147 | 145 |
| 148 return new PrefService( | 146 return new PrefService( |
| 149 managed_platform, managed_cloud, extension_prefs, | 147 managed_platform, managed_cloud, extension_prefs, |
| 150 command_line, user, recommended_platform, | 148 command_line, user, recommended_platform, |
| 151 recommended_cloud, default_pref_store, async); | 149 recommended_cloud, default_pref_store, async); |
| 152 } | 150 } |
| 153 | 151 |
| 154 PrefService* PrefService::CreateIncognitoPrefService( | 152 PrefService* PrefService::CreateIncognitoPrefService( |
| 155 PrefStore* incognito_extension_prefs) { | 153 PrefStore* incognito_extension_prefs) { |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 886 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 889 } | 887 } |
| 890 | 888 |
| 891 bool PrefService::Preference::IsUserModifiable() const { | 889 bool PrefService::Preference::IsUserModifiable() const { |
| 892 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 890 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 893 } | 891 } |
| 894 | 892 |
| 895 bool PrefService::Preference::IsExtensionModifiable() const { | 893 bool PrefService::Preference::IsExtensionModifiable() const { |
| 896 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 894 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 897 } | 895 } |
| OLD | NEW |