| 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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 const char* Profile::kProfileKey = "__PROFILE__"; | 92 const char* Profile::kProfileKey = "__PROFILE__"; |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 const ProfileId Profile::kInvalidProfileId = static_cast<ProfileId>(0); | 95 const ProfileId Profile::kInvalidProfileId = static_cast<ProfileId>(0); |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 void Profile::RegisterUserPrefs(PrefService* prefs) { | 98 void Profile::RegisterUserPrefs(PrefService* prefs) { |
| 99 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); | 99 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, |
| 100 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); | 100 true, |
| 101 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); | 101 PrefService::SYNCABLE_PREF); |
| 102 prefs->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled, false); | 102 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, |
| 103 true, |
| 104 PrefService::UNSYNCABLE_PREF); |
| 105 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, |
| 106 true, |
| 107 PrefService::SYNCABLE_PREF); |
| 108 prefs->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled, |
| 109 false, |
| 110 PrefService::UNSYNCABLE_PREF); |
| 103 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 111 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
| 104 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, | 112 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, |
| 105 IDS_SPELLCHECK_DICTIONARY); | 113 IDS_SPELLCHECK_DICTIONARY, |
| 106 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); | 114 PrefService::UNSYNCABLE_PREF); |
| 107 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); | 115 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, |
| 116 true, |
| 117 PrefService::SYNCABLE_PREF); |
| 118 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, |
| 119 true, |
| 120 PrefService::UNSYNCABLE_PREF); |
| 108 #if defined(TOOLKIT_USES_GTK) | 121 #if defined(TOOLKIT_USES_GTK) |
| 109 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, | 122 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, |
| 110 GtkThemeService::DefaultUsesSystemTheme()); | 123 GtkThemeService::DefaultUsesSystemTheme(), |
| 124 PrefService::UNSYNCABLE_PREF); |
| 111 #endif | 125 #endif |
| 112 prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, FilePath()); | 126 prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, |
| 127 FilePath(), |
| 128 PrefService::UNSYNCABLE_PREF); |
| 113 prefs->RegisterStringPref(prefs::kCurrentThemeID, | 129 prefs->RegisterStringPref(prefs::kCurrentThemeID, |
| 114 ThemeService::kDefaultThemeID); | 130 ThemeService::kDefaultThemeID, |
| 115 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); | 131 PrefService::UNSYNCABLE_PREF); |
| 116 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); | 132 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages, |
| 117 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints); | 133 PrefService::UNSYNCABLE_PREF); |
| 118 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); | 134 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors, |
| 119 prefs->RegisterBooleanPref(prefs::kDisableExtensions, false); | 135 PrefService::UNSYNCABLE_PREF); |
| 120 prefs->RegisterStringPref(prefs::kSelectFileLastDirectory, ""); | 136 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints, |
| 137 PrefService::UNSYNCABLE_PREF); |
| 138 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties, |
| 139 PrefService::UNSYNCABLE_PREF); |
| 140 prefs->RegisterBooleanPref(prefs::kDisableExtensions, |
| 141 false, |
| 142 PrefService::UNSYNCABLE_PREF); |
| 143 prefs->RegisterStringPref(prefs::kSelectFileLastDirectory, |
| 144 "", |
| 145 PrefService::UNSYNCABLE_PREF); |
| 121 #if defined(OS_CHROMEOS) | 146 #if defined(OS_CHROMEOS) |
| 122 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both | 147 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both |
| 123 // local state and user's profile. For other platforms we maintain | 148 // local state and user's profile. For other platforms we maintain |
| 124 // kApplicationLocale only in local state. | 149 // kApplicationLocale only in local state. |
| 125 // In the future we may want to maintain kApplicationLocale | 150 // In the future we may want to maintain kApplicationLocale |
| 126 // in user's profile for other platforms as well. | 151 // in user's profile for other platforms as well. |
| 127 prefs->RegisterStringPref(prefs::kApplicationLocale, ""); | 152 prefs->RegisterStringPref(prefs::kApplicationLocale, |
| 128 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, ""); | 153 "", |
| 129 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, ""); | 154 PrefService::SYNCABLE_PREF); |
| 155 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, |
| 156 "", |
| 157 PrefService::UNSYNCABLE_PREF); |
| 158 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, |
| 159 "", |
| 160 PrefService::UNSYNCABLE_PREF); |
| 130 #endif | 161 #endif |
| 131 } | 162 } |
| 132 | 163 |
| 133 // static | 164 // static |
| 134 net::URLRequestContextGetter* Profile::GetDefaultRequestContext() { | 165 net::URLRequestContextGetter* Profile::GetDefaultRequestContext() { |
| 135 return default_request_context_; | 166 return default_request_context_; |
| 136 } | 167 } |
| 137 | 168 |
| 138 bool Profile::IsGuestSession() { | 169 bool Profile::IsGuestSession() { |
| 139 #if defined(OS_CHROMEOS) | 170 #if defined(OS_CHROMEOS) |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 }; | 794 }; |
| 764 #endif | 795 #endif |
| 765 | 796 |
| 766 Profile* Profile::CreateOffTheRecordProfile() { | 797 Profile* Profile::CreateOffTheRecordProfile() { |
| 767 #if defined(OS_CHROMEOS) | 798 #if defined(OS_CHROMEOS) |
| 768 if (Profile::IsGuestSession()) | 799 if (Profile::IsGuestSession()) |
| 769 return new GuestSessionProfile(this); | 800 return new GuestSessionProfile(this); |
| 770 #endif | 801 #endif |
| 771 return new OffTheRecordProfileImpl(this); | 802 return new OffTheRecordProfileImpl(this); |
| 772 } | 803 } |
| OLD | NEW |