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