| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/ui/browser_ui_prefs.h" | 5 #include "chrome/browser/ui/browser_ui_prefs.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" |
| 9 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 12 #include "components/pref_registry/pref_registry_syncable.h" | 13 #include "components/pref_registry/pref_registry_syncable.h" |
| 13 #include "components/translate/core/common/translate_pref_names.h" | 14 #include "components/translate/core/common/translate_pref_names.h" |
| 14 | 15 |
| 15 namespace chrome { | 16 namespace chrome { |
| 16 | 17 |
| 17 void RegisterBrowserPrefs(PrefRegistrySimple* registry) { | 18 void RegisterBrowserPrefs(PrefRegistrySimple* registry) { |
| 18 registry->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0); | 19 registry->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 registry->RegisterBooleanPref( | 119 registry->RegisterBooleanPref( |
| 119 prefs::kDevToolsDisabled, | 120 prefs::kDevToolsDisabled, |
| 120 false, | 121 false, |
| 121 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 122 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 122 registry->RegisterDictionaryPref( | 123 registry->RegisterDictionaryPref( |
| 123 prefs::kBrowserWindowPlacement, | 124 prefs::kBrowserWindowPlacement, |
| 124 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 125 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 125 registry->RegisterDictionaryPref( | 126 registry->RegisterDictionaryPref( |
| 126 prefs::kBrowserWindowPlacementPopup, | 127 prefs::kBrowserWindowPlacementPopup, |
| 127 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 128 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 129 registry->RegisterDictionaryPref( |
| 130 prefs::kAppWindowPlacement, |
| 131 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 128 registry->RegisterBooleanPref( | 132 registry->RegisterBooleanPref( |
| 129 prefs::kImportAutofillFormData, | 133 prefs::kImportAutofillFormData, |
| 130 true, | 134 true, |
| 131 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 132 registry->RegisterBooleanPref( | 136 registry->RegisterBooleanPref( |
| 133 prefs::kImportBookmarks, | 137 prefs::kImportBookmarks, |
| 134 true, | 138 true, |
| 135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 136 registry->RegisterBooleanPref( | 140 registry->RegisterBooleanPref( |
| 137 prefs::kImportHistory, | 141 prefs::kImportHistory, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 false, | 185 false, |
| 182 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 186 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 183 #if !defined(OS_MACOSX) | 187 #if !defined(OS_MACOSX) |
| 184 registry->RegisterBooleanPref( | 188 registry->RegisterBooleanPref( |
| 185 prefs::kFullscreenAllowed, | 189 prefs::kFullscreenAllowed, |
| 186 true, | 190 true, |
| 187 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 191 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 188 #endif | 192 #endif |
| 189 } | 193 } |
| 190 | 194 |
| 191 void RegisterAppPrefs(const std::string& app_name, Profile* profile) { | |
| 192 // We need to register the window position pref. | |
| 193 // | |
| 194 // TODO(mnissler): Use a separate pref name pointing to a single | |
| 195 // dictionary instead. Also tracked as http://crbug.com/167256 | |
| 196 std::string window_pref(prefs::kBrowserWindowPlacement); | |
| 197 window_pref.append("_"); | |
| 198 window_pref.append(app_name); | |
| 199 PrefService* prefs = profile->GetPrefs(); | |
| 200 if (!prefs->FindPreference(window_pref.c_str())) { | |
| 201 // TODO(joi): Do all registration up front. | |
| 202 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( | |
| 203 static_cast<user_prefs::PrefRegistrySyncable*>( | |
| 204 prefs->DeprecatedGetPrefRegistry())); | |
| 205 registry->RegisterDictionaryPref( | |
| 206 window_pref.c_str(), user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 207 } | |
| 208 } | |
| 209 | |
| 210 | |
| 211 } // namespace chrome | 195 } // namespace chrome |
| OLD | NEW |