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. 4 5 #include "chrome/browser/ui/browser_ui_prefs.h" 6 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" 15 16 namespace chrome { 17 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); 23 } 24 25 void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) { 26 registry->RegisterBooleanPref( 27 prefs::kHomePageIsNewTabPage, 28 true, 29 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 30 registry->RegisterBooleanPref( 31 prefs::kShowHomeButton, 32 false, 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( 44 prefs::kShowUpdatePromotionInfoBar, 45 true, 46 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 47 #endif 48 registry->RegisterBooleanPref( 49 prefs::kDeleteBrowsingHistory, 50 true, 51 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 52 registry->RegisterBooleanPref( 53 prefs::kDeleteDownloadHistory, 54 true, 55 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 56 registry->RegisterBooleanPref( 57 prefs::kDeleteCache, 58 true, 59 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 60 registry->RegisterBooleanPref( 61 prefs::kDeleteCookies, 62 true, 63 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 64 registry->RegisterBooleanPref( 65 prefs::kDeletePasswords, 66 false, 67 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 68 registry->RegisterBooleanPref( 69 prefs::kDeleteFormData, 70 false, 71 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 72 registry->RegisterBooleanPref( 73 prefs::kDeleteHostedAppsData, 74 false, 75 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 76 registry->RegisterIntegerPref( 77 prefs::kDeleteTimePeriod, 78 0, 79 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 80 registry->RegisterInt64Pref( 81 prefs::kLastClearBrowsingDataTime, 82 0, 83 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 84 registry->RegisterIntegerPref(prefs::kModuleConflictBubbleShown, 85 0, 86 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 87 registry->RegisterBooleanPref( 88 prefs::kCheckDefaultBrowser, 89 true, 90 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 91 registry->RegisterBooleanPref( 92 prefs::kWebAppCreateOnDesktop, 93 true, 94 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 95 registry->RegisterBooleanPref( 96 prefs::kWebAppCreateInAppsMenu, 97 true, 98 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 99 registry->RegisterBooleanPref( 100 prefs::kWebAppCreateInQuickLaunchBar, 101 true, 102 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 103 registry->RegisterBooleanPref( 104 prefs::kEnableTranslate, 105 true, 106 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 107 registry->RegisterStringPref( 108 prefs::kCloudPrintEmail, 109 std::string(), 110 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 111 registry->RegisterBooleanPref( 112 prefs::kCloudPrintProxyEnabled, 113 true, 114 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 115 registry->RegisterBooleanPref( 116 prefs::kCloudPrintSubmitEnabled, 117 true, 118 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 119 registry->RegisterBooleanPref( 120 prefs::kDevToolsDisabled, 121 false, 122 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 123 registry->RegisterDictionaryPref( 124 prefs::kBrowserWindowPlacement, 125 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 126 registry->RegisterDictionaryPref( 127 prefs::kBrowserWindowPlacementPopup, 128 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 129 registry->RegisterDictionaryPref( 130 prefs::kAppWindowPlacement, 131 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 132 registry->RegisterBooleanPref( 133 prefs::kImportAutofillFormData, 134 true, 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::kImportSavedPasswords, 150 true, 151 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 152 registry->RegisterBooleanPref( 153 prefs::kImportSearchEngine, 154 true, 155 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 156 registry->RegisterBooleanPref( 157 prefs::kEnableDoNotTrack, 158 false, 159 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 160 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); 168 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 193 } 194 195 } // namespace chrome 196