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

Side by Side Diff: chrome/browser/profiles/profile.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the previous fix Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 // static 90 // static
91 const char* Profile::kProfileKey = "__PROFILE__"; 91 const char* Profile::kProfileKey = "__PROFILE__";
92 92
93 // static 93 // static
94 const ProfileId Profile::kInvalidProfileId = static_cast<ProfileId>(0); 94 const ProfileId Profile::kInvalidProfileId = static_cast<ProfileId>(0);
95 95
96 // static 96 // static
97 void Profile::RegisterUserPrefs(PrefService* prefs) { 97 void Profile::RegisterUserPrefs(PrefService* prefs) {
98 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); 98 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled,
99 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); 99 true,
100 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); 100 true /* sync pref */);
101 prefs->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled, false); 101 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly,
102 true,
103 false /* don't sync pref */);
104 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled,
105 true,
106 true /* sync pref */);
107 prefs->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled,
108 false,
109 false /* don't sync pref */);
102 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. 110 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string.
103 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, 111 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary,
104 IDS_SPELLCHECK_DICTIONARY); 112 IDS_SPELLCHECK_DICTIONARY,
105 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); 113 false /* don't sync pref */);
106 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); 114 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck,
115 true,
116 true /* sync pref */);
117 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect,
118 true,
119 false /* don't sync pref */);
107 #if defined(TOOLKIT_USES_GTK) 120 #if defined(TOOLKIT_USES_GTK)
108 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, 121 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme,
109 GtkThemeService::DefaultUsesSystemTheme()); 122 GtkThemeService::DefaultUsesSystemTheme(),
123 false /* don't sync pref */);
110 #endif 124 #endif
111 prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, FilePath()); 125 prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename,
126 FilePath(),
127 false /* don't sync pref */);
112 prefs->RegisterStringPref(prefs::kCurrentThemeID, 128 prefs->RegisterStringPref(prefs::kCurrentThemeID,
113 ThemeService::kDefaultThemeID); 129 ThemeService::kDefaultThemeID,
114 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); 130 false /* don't sync pref */);
115 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); 131 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages,
116 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints); 132 false /* don't sync pref */);
117 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); 133 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors,
118 prefs->RegisterBooleanPref(prefs::kDisableExtensions, false); 134 false /* don't sync pref */);
119 prefs->RegisterStringPref(prefs::kSelectFileLastDirectory, ""); 135 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints,
136 false /* don't sync pref */);
137 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties,
138 false /* don't sync pref */);
139 prefs->RegisterBooleanPref(prefs::kDisableExtensions,
140 false,
141 false /* don't sync pref */);
142 prefs->RegisterStringPref(prefs::kSelectFileLastDirectory,
143 "",
144 false /* don't sync pref */);
120 #if defined(OS_CHROMEOS) 145 #if defined(OS_CHROMEOS)
121 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both 146 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both
122 // local state and user's profile. For other platforms we maintain 147 // local state and user's profile. For other platforms we maintain
123 // kApplicationLocale only in local state. 148 // kApplicationLocale only in local state.
124 // In the future we may want to maintain kApplicationLocale 149 // In the future we may want to maintain kApplicationLocale
125 // in user's profile for other platforms as well. 150 // in user's profile for other platforms as well.
126 prefs->RegisterStringPref(prefs::kApplicationLocale, ""); 151 prefs->RegisterStringPref(prefs::kApplicationLocale,
127 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, ""); 152 "",
128 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, ""); 153 true /* sync pref */);
154 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup,
155 "",
156 false /* don't sync pref */);
157 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted,
158 "",
159 false /* don't sync pref */);
129 #endif 160 #endif
130 } 161 }
131 162
132 // static 163 // static
133 net::URLRequestContextGetter* Profile::GetDefaultRequestContext() { 164 net::URLRequestContextGetter* Profile::GetDefaultRequestContext() {
134 return default_request_context_; 165 return default_request_context_;
135 } 166 }
136 167
137 bool Profile::IsGuestSession() { 168 bool Profile::IsGuestSession() {
138 #if defined(OS_CHROMEOS) 169 #if defined(OS_CHROMEOS)
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 }; 798 };
768 #endif 799 #endif
769 800
770 Profile* Profile::CreateOffTheRecordProfile() { 801 Profile* Profile::CreateOffTheRecordProfile() {
771 #if defined(OS_CHROMEOS) 802 #if defined(OS_CHROMEOS)
772 if (Profile::IsGuestSession()) 803 if (Profile::IsGuestSession())
773 return new GuestSessionProfile(this); 804 return new GuestSessionProfile(this);
774 #endif 805 #endif
775 return new OffTheRecordProfileImpl(this); 806 return new OffTheRecordProfileImpl(this);
776 } 807 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698