NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / browser_ui_prefs.cc
blob132bd72262ddbc660ef352af318e251b5cf1a283
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser_ui_prefs.h"
7 #include "base/prefs/pref_registry_simple.h"
8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/first_run/first_run.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/pref_names.h"
12 #include "components/translate/core/common/translate_pref_names.h"
13 #include "components/user_prefs/pref_registry_syncable.h"
15 namespace chrome {
17 void RegisterBrowserPrefs(PrefRegistrySimple* registry) {
18 registry->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0);
19 registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
20 registry->RegisterIntegerPref(prefs::kShowFirstRunBubbleOption,
21 first_run::FIRST_RUN_BUBBLE_DONT_SHOW);
24 void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
25 registry->RegisterBooleanPref(
26 prefs::kHomePageIsNewTabPage,
27 true,
28 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
29 registry->RegisterBooleanPref(
30 prefs::kShowHomeButton,
31 false,
32 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
33 #if defined(OS_MACOSX)
34 // This really belongs in platform code, but there's no good place to
35 // initialize it between the time when the AppController is created
36 // (where there's no profile) and the time the controller gets another
37 // crack at the start of the main event loop. By that time,
38 // StartupBrowserCreator has already created the browser window, and it's too
39 // late: we need the pref to be already initialized. Doing it here also saves
40 // us from having to hard-code pref registration in the several unit tests
41 // that use this preference.
42 registry->RegisterBooleanPref(
43 prefs::kShowUpdatePromotionInfoBar,
44 true,
45 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
46 #endif
47 registry->RegisterBooleanPref(
48 prefs::kDeleteBrowsingHistory,
49 true,
50 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
51 registry->RegisterBooleanPref(
52 prefs::kDeleteDownloadHistory,
53 true,
54 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
55 registry->RegisterBooleanPref(
56 prefs::kDeleteCache,
57 true,
58 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
59 registry->RegisterBooleanPref(
60 prefs::kDeleteCookies,
61 true,
62 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
63 registry->RegisterBooleanPref(
64 prefs::kDeletePasswords,
65 false,
66 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
67 registry->RegisterBooleanPref(
68 prefs::kDeleteFormData,
69 false,
70 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
71 registry->RegisterBooleanPref(
72 prefs::kDeleteHostedAppsData,
73 false,
74 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
75 registry->RegisterIntegerPref(
76 prefs::kDeleteTimePeriod,
78 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
79 registry->RegisterInt64Pref(
80 prefs::kLastClearBrowsingDataTime,
82 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
83 registry->RegisterIntegerPref(prefs::kModuleConflictBubbleShown,
85 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
86 registry->RegisterBooleanPref(
87 prefs::kCheckDefaultBrowser,
88 true,
89 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
90 #if defined(OS_WIN)
91 // As with Mac-spacific code above, it should be in a platform-specific
92 // section somewhere, but there is no good place for it.
93 registry->RegisterBooleanPref(
94 prefs::kSuppressSwitchToMetroModeOnSetDefault,
95 false,
96 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
97 #endif
98 registry->RegisterBooleanPref(
99 prefs::kWebAppCreateOnDesktop,
100 true,
101 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
102 registry->RegisterBooleanPref(
103 prefs::kWebAppCreateInAppsMenu,
104 true,
105 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
106 registry->RegisterBooleanPref(
107 prefs::kWebAppCreateInQuickLaunchBar,
108 true,
109 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
110 registry->RegisterBooleanPref(
111 prefs::kEnableTranslate,
112 true,
113 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
114 registry->RegisterStringPref(
115 prefs::kCloudPrintEmail,
116 std::string(),
117 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
118 registry->RegisterBooleanPref(
119 prefs::kCloudPrintProxyEnabled,
120 true,
121 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
122 registry->RegisterBooleanPref(
123 prefs::kCloudPrintSubmitEnabled,
124 true,
125 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
126 registry->RegisterBooleanPref(
127 prefs::kDevToolsDisabled,
128 false,
129 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
130 registry->RegisterDictionaryPref(
131 prefs::kBrowserWindowPlacement,
132 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
133 registry->RegisterDictionaryPref(
134 prefs::kPreferencesWindowPlacement,
135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
136 registry->RegisterBooleanPref(
137 prefs::kImportBookmarks,
138 true,
139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
140 registry->RegisterBooleanPref(
141 prefs::kImportHistory,
142 true,
143 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
144 registry->RegisterBooleanPref(
145 prefs::kImportHomepage,
146 true,
147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
148 registry->RegisterBooleanPref(
149 prefs::kImportSearchEngine,
150 true,
151 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
152 registry->RegisterBooleanPref(
153 prefs::kImportSavedPasswords,
154 true,
155 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
156 registry->RegisterBooleanPref(
157 prefs::kEnableDoNotTrack,
158 false,
159 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
161 // Dictionaries to keep track of default tasks in the file browser.
162 registry->RegisterDictionaryPref(
163 prefs::kDefaultTasksByMimeType,
164 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
165 registry->RegisterDictionaryPref(
166 prefs::kDefaultTasksBySuffix,
167 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
169 // We need to register the type of these preferences in order to query
170 // them even though they're only typically controlled via policy.
171 registry->RegisterBooleanPref(
172 prefs::kPluginsAllowOutdated,
173 false,
174 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
175 registry->RegisterBooleanPref(
176 prefs::kPluginsAlwaysAuthorize,
177 false,
178 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
179 registry->RegisterBooleanPref(
180 prefs::kClearPluginLSODataEnabled,
181 true,
182 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
183 registry->RegisterBooleanPref(
184 prefs::kHideWebStoreIcon,
185 false,
186 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
187 #if !defined(OS_MACOSX)
188 registry->RegisterBooleanPref(
189 prefs::kFullscreenAllowed,
190 true,
191 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
192 #endif
195 void RegisterAppPrefs(const std::string& app_name, Profile* profile) {
196 // We need to register the window position pref.
198 // TODO(mnissler): Use a separate pref name pointing to a single
199 // dictionary instead. Also tracked as http://crbug.com/167256
200 std::string window_pref(prefs::kBrowserWindowPlacement);
201 window_pref.append("_");
202 window_pref.append(app_name);
203 PrefService* prefs = profile->GetPrefs();
204 if (!prefs->FindPreference(window_pref.c_str())) {
205 // TODO(joi): Do all registration up front.
206 scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
207 static_cast<user_prefs::PrefRegistrySyncable*>(
208 prefs->DeprecatedGetPrefRegistry()));
209 registry->RegisterDictionaryPref(
210 window_pref.c_str(), user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
215 } // namespace chrome