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 "base/prefs/scoped_user_pref_update.h"
10 #include "chrome/browser/first_run/first_run.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h"
13 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/translate/core/common/translate_pref_names.h"
18 void RegisterBrowserPrefs(PrefRegistrySimple
* registry
) {
19 registry
->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex
, 0);
20 registry
->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs
, true);
21 registry
->RegisterIntegerPref(prefs::kShowFirstRunBubbleOption
,
22 first_run::FIRST_RUN_BUBBLE_DONT_SHOW
);
25 void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable
* registry
) {
26 registry
->RegisterBooleanPref(
27 prefs::kHomePageIsNewTabPage
,
29 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
30 registry
->RegisterBooleanPref(
31 prefs::kShowHomeButton
,
33 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
34 #if defined(OS_MACOSX)
35 // This really belongs in platform code, but there's no good place to
36 // initialize it between the time when the AppController is created
37 // (where there's no profile) and the time the controller gets another
38 // crack at the start of the main event loop. By that time,
39 // StartupBrowserCreator has already created the browser window, and it's too
40 // late: we need the pref to be already initialized. Doing it here also saves
41 // us from having to hard-code pref registration in the several unit tests
42 // that use this preference.
43 registry
->RegisterBooleanPref(prefs::kShowUpdatePromotionInfoBar
, true);
45 registry
->RegisterBooleanPref(
46 prefs::kDeleteBrowsingHistory
,
48 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
49 registry
->RegisterBooleanPref(
50 prefs::kDeleteDownloadHistory
,
52 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
53 registry
->RegisterBooleanPref(
56 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
57 registry
->RegisterBooleanPref(
58 prefs::kDeleteCookies
,
60 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
61 registry
->RegisterBooleanPref(
62 prefs::kDeletePasswords
,
64 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
65 registry
->RegisterBooleanPref(
66 prefs::kDeleteFormData
,
68 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
69 registry
->RegisterBooleanPref(
70 prefs::kDeleteHostedAppsData
,
72 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
73 registry
->RegisterIntegerPref(
74 prefs::kDeleteTimePeriod
,
76 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
77 registry
->RegisterInt64Pref(prefs::kLastClearBrowsingDataTime
, 0);
78 registry
->RegisterIntegerPref(prefs::kModuleConflictBubbleShown
, 0);
79 registry
->RegisterBooleanPref(prefs::kCheckDefaultBrowser
, true);
80 registry
->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop
, true);
81 registry
->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu
, true);
82 registry
->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar
, true);
83 registry
->RegisterBooleanPref(
84 prefs::kEnableTranslate
,
86 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
87 registry
->RegisterStringPref(prefs::kCloudPrintEmail
, std::string());
88 registry
->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled
, true);
89 registry
->RegisterBooleanPref(prefs::kCloudPrintSubmitEnabled
, true);
90 registry
->RegisterBooleanPref(prefs::kDevToolsDisabled
, false);
91 registry
->RegisterDictionaryPref(prefs::kBrowserWindowPlacement
);
92 registry
->RegisterDictionaryPref(prefs::kBrowserWindowPlacementPopup
);
93 registry
->RegisterDictionaryPref(prefs::kAppWindowPlacement
);
94 registry
->RegisterBooleanPref(prefs::kImportAutofillFormData
, true);
95 registry
->RegisterBooleanPref(prefs::kImportBookmarks
, true);
96 registry
->RegisterBooleanPref(prefs::kImportHistory
, true);
97 registry
->RegisterBooleanPref(prefs::kImportHomepage
, true);
98 registry
->RegisterBooleanPref(prefs::kImportSavedPasswords
, true);
99 registry
->RegisterBooleanPref(prefs::kImportSearchEngine
, true);
100 registry
->RegisterBooleanPref(
101 prefs::kEnableDoNotTrack
,
103 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
104 #if defined(ENABLE_WEBRTC)
105 registry
->RegisterBooleanPref(prefs::kWebRTCMultipleRoutesEnabled
, true);
106 registry
->RegisterBooleanPref(prefs::kWebRTCNonProxiedUdpEnabled
, true);
109 // Dictionaries to keep track of default tasks in the file browser.
110 registry
->RegisterDictionaryPref(
111 prefs::kDefaultTasksByMimeType
,
112 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
113 registry
->RegisterDictionaryPref(
114 prefs::kDefaultTasksBySuffix
,
115 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF
);
117 // We need to register the type of these preferences in order to query
118 // them even though they're only typically controlled via policy.
119 registry
->RegisterBooleanPref(prefs::kPluginsAllowOutdated
, false);
120 registry
->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize
, false);
121 registry
->RegisterBooleanPref(prefs::kClearPluginLSODataEnabled
, true);
122 registry
->RegisterBooleanPref(prefs::kHideWebStoreIcon
, false);
123 #if !defined(OS_MACOSX)
124 registry
->RegisterBooleanPref(prefs::kFullscreenAllowed
, true);
128 } // namespace chrome