| 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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 registry->RegisterBooleanPref( | 77 registry->RegisterBooleanPref( |
| 78 prefs::kSearchSuggestEnabled, | 78 prefs::kSearchSuggestEnabled, |
| 79 true, | 79 true, |
| 80 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 80 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 81 #if defined(OS_ANDROID) | 81 #if defined(OS_ANDROID) |
| 82 registry->RegisterStringPref( | 82 registry->RegisterStringPref( |
| 83 prefs::kContextualSearchEnabled, | 83 prefs::kContextualSearchEnabled, |
| 84 std::string(), | 84 std::string(), |
| 85 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 85 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 86 #endif | 86 #endif |
| 87 registry->RegisterBooleanPref( | 87 registry->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); |
| 88 prefs::kSessionExitedCleanly, | 88 registry->RegisterStringPref(prefs::kSessionExitType, std::string()); |
| 89 true, | |
| 90 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 91 registry->RegisterStringPref( | |
| 92 prefs::kSessionExitType, | |
| 93 std::string(), | |
| 94 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 95 registry->RegisterBooleanPref( | 89 registry->RegisterBooleanPref( |
| 96 prefs::kSafeBrowsingEnabled, | 90 prefs::kSafeBrowsingEnabled, |
| 97 true, | 91 true, |
| 98 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 92 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 93 registry->RegisterBooleanPref(prefs::kSafeBrowsingExtendedReportingEnabled, |
| 94 false); |
| 95 registry->RegisterBooleanPref(prefs::kSafeBrowsingProceedAnywayDisabled, |
| 96 false); |
| 97 registry->RegisterBooleanPref(prefs::kSSLErrorOverrideAllowed, true); |
| 98 registry->RegisterDictionaryPref(prefs::kSafeBrowsingIncidentsSent); |
| 99 registry->RegisterBooleanPref( | 99 registry->RegisterBooleanPref( |
| 100 prefs::kSafeBrowsingExtendedReportingEnabled, | 100 prefs::kSafeBrowsingExtendedReportingOptInAllowed, true); |
| 101 false, | |
| 102 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 103 registry->RegisterBooleanPref( | |
| 104 prefs::kSafeBrowsingProceedAnywayDisabled, | |
| 105 false, | |
| 106 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 107 registry->RegisterBooleanPref( | |
| 108 prefs::kSSLErrorOverrideAllowed, | |
| 109 true, | |
| 110 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 111 registry->RegisterDictionaryPref( | |
| 112 prefs::kSafeBrowsingIncidentsSent, | |
| 113 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 114 registry->RegisterBooleanPref( | |
| 115 prefs::kSafeBrowsingExtendedReportingOptInAllowed, true, | |
| 116 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 117 #if defined(ENABLE_GOOGLE_NOW) | 101 #if defined(ENABLE_GOOGLE_NOW) |
| 118 registry->RegisterBooleanPref( | 102 registry->RegisterBooleanPref(prefs::kGoogleGeolocationAccessEnabled, false); |
| 119 prefs::kGoogleGeolocationAccessEnabled, | |
| 120 false, | |
| 121 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 122 #endif | 103 #endif |
| 123 // This pref is intentionally outside the above #if. That flag corresponds | 104 // This pref is intentionally outside the above #if. That flag corresponds |
| 124 // to the Notifier extension and does not gate the launcher page. | 105 // to the Notifier extension and does not gate the launcher page. |
| 125 // TODO(skare): Remove or rename ENABLE_GOOGLE_NOW: http://crbug.com/459827. | 106 // TODO(skare): Remove or rename ENABLE_GOOGLE_NOW: http://crbug.com/459827. |
| 126 registry->RegisterBooleanPref( | 107 registry->RegisterBooleanPref(prefs::kGoogleNowLauncherEnabled, true); |
| 127 prefs::kGoogleNowLauncherEnabled, | 108 registry->RegisterBooleanPref(prefs::kDisableExtensions, false); |
| 128 true, | |
| 129 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 130 registry->RegisterBooleanPref( | |
| 131 prefs::kDisableExtensions, | |
| 132 false, | |
| 133 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 134 #if defined(ENABLE_EXTENSIONS) | 109 #if defined(ENABLE_EXTENSIONS) |
| 135 registry->RegisterBooleanPref( | 110 registry->RegisterBooleanPref(extensions::pref_names::kAlertsInitialized, |
| 136 extensions::pref_names::kAlertsInitialized, | 111 false); |
| 137 false, | |
| 138 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 139 #endif | 112 #endif |
| 140 registry->RegisterStringPref( | 113 registry->RegisterStringPref(prefs::kSelectFileLastDirectory, std::string()); |
| 141 prefs::kSelectFileLastDirectory, | |
| 142 std::string(), | |
| 143 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 144 // TODO(wjmaclean): remove the following two prefs once migration to per- | 114 // TODO(wjmaclean): remove the following two prefs once migration to per- |
| 145 // partition zoom is complete. | 115 // partition zoom is complete. |
| 146 registry->RegisterDoublePref( | 116 registry->RegisterDoublePref(prefs::kDefaultZoomLevelDeprecated, 0.0); |
| 147 prefs::kDefaultZoomLevelDeprecated, | 117 registry->RegisterDictionaryPref(prefs::kPerHostZoomLevelsDeprecated); |
| 148 0.0, | |
| 149 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 150 registry->RegisterDictionaryPref( | |
| 151 prefs::kPerHostZoomLevelsDeprecated, | |
| 152 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 153 | 118 |
| 154 registry->RegisterDictionaryPref( | 119 registry->RegisterDictionaryPref(prefs::kPartitionDefaultZoomLevel); |
| 155 prefs::kPartitionDefaultZoomLevel, | 120 registry->RegisterDictionaryPref(prefs::kPartitionPerHostZoomLevels); |
| 156 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 121 registry->RegisterStringPref(prefs::kDefaultApps, "install"); |
| 157 registry->RegisterDictionaryPref( | 122 registry->RegisterBooleanPref(prefs::kSpeechRecognitionFilterProfanities, |
| 158 prefs::kPartitionPerHostZoomLevels, | 123 true); |
| 159 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 124 registry->RegisterIntegerPref(prefs::kProfileIconVersion, 0); |
| 160 registry->RegisterStringPref( | |
| 161 prefs::kDefaultApps, | |
| 162 "install", | |
| 163 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 164 registry->RegisterBooleanPref( | |
| 165 prefs::kSpeechRecognitionFilterProfanities, | |
| 166 true, | |
| 167 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 168 registry->RegisterIntegerPref( | |
| 169 prefs::kProfileIconVersion, | |
| 170 0, | |
| 171 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 172 #if defined(OS_CHROMEOS) | 125 #if defined(OS_CHROMEOS) |
| 173 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both | 126 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both |
| 174 // local state and user's profile. For other platforms we maintain | 127 // local state and user's profile. For other platforms we maintain |
| 175 // kApplicationLocale only in local state. | 128 // kApplicationLocale only in local state. |
| 176 // In the future we may want to maintain kApplicationLocale | 129 // In the future we may want to maintain kApplicationLocale |
| 177 // in user's profile for other platforms as well. | 130 // in user's profile for other platforms as well. |
| 178 registry->RegisterStringPref( | 131 registry->RegisterStringPref( |
| 179 prefs::kApplicationLocale, | 132 prefs::kApplicationLocale, |
| 180 std::string(), | 133 std::string(), |
| 181 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); | 134 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); |
| 182 registry->RegisterStringPref( | 135 registry->RegisterStringPref(prefs::kApplicationLocaleBackup, std::string()); |
| 183 prefs::kApplicationLocaleBackup, | 136 registry->RegisterStringPref(prefs::kApplicationLocaleAccepted, |
| 184 std::string(), | 137 std::string()); |
| 185 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 138 registry->RegisterStringPref(prefs::kCurrentWallpaperAppName, std::string()); |
| 186 registry->RegisterStringPref( | |
| 187 prefs::kApplicationLocaleAccepted, | |
| 188 std::string(), | |
| 189 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 190 registry->RegisterStringPref( | |
| 191 prefs::kCurrentWallpaperAppName, | |
| 192 std::string(), | |
| 193 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 194 #endif | 139 #endif |
| 195 | 140 |
| 196 #if defined(OS_ANDROID) | 141 #if defined(OS_ANDROID) |
| 197 registry->RegisterBooleanPref( | 142 registry->RegisterBooleanPref(prefs::kDevToolsRemoteEnabled, false); |
| 198 prefs::kDevToolsRemoteEnabled, | |
| 199 false, | |
| 200 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 201 #endif | 143 #endif |
| 202 | 144 |
| 203 data_reduction_proxy::RegisterSyncableProfilePrefs(registry); | 145 data_reduction_proxy::RegisterSyncableProfilePrefs(registry); |
| 204 | 146 |
| 205 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_IOS) | 147 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_IOS) |
| 206 // Preferences related to the avatar bubble and user manager tutorials. | 148 // Preferences related to the avatar bubble and user manager tutorials. |
| 207 registry->RegisterIntegerPref( | 149 registry->RegisterIntegerPref(prefs::kProfileAvatarTutorialShown, 0); |
| 208 prefs::kProfileAvatarTutorialShown, | |
| 209 0, | |
| 210 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 211 #endif | 150 #endif |
| 212 } | 151 } |
| 213 | 152 |
| 214 std::string Profile::GetDebugName() { | 153 std::string Profile::GetDebugName() { |
| 215 std::string name = GetPath().BaseName().MaybeAsASCII(); | 154 std::string name = GetPath().BaseName().MaybeAsASCII(); |
| 216 if (name.empty()) { | 155 if (name.empty()) { |
| 217 name = "UnknownProfile"; | 156 name = "UnknownProfile"; |
| 218 } | 157 } |
| 219 return name; | 158 return name; |
| 220 } | 159 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (a->IsSameProfile(b)) | 209 if (a->IsSameProfile(b)) |
| 271 return false; | 210 return false; |
| 272 return a->GetOriginalProfile() < b->GetOriginalProfile(); | 211 return a->GetOriginalProfile() < b->GetOriginalProfile(); |
| 273 } | 212 } |
| 274 | 213 |
| 275 double Profile::GetDefaultZoomLevelForProfile() { | 214 double Profile::GetDefaultZoomLevelForProfile() { |
| 276 return GetDefaultStoragePartition(this) | 215 return GetDefaultStoragePartition(this) |
| 277 ->GetHostZoomMap() | 216 ->GetHostZoomMap() |
| 278 ->GetDefaultZoomLevel(); | 217 ->GetDefaultZoomLevel(); |
| 279 } | 218 } |
| OLD | NEW |