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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return new ProfileImpl(path, delegate, create_mode, sequenced_task_runner); | 265 return new ProfileImpl(path, delegate, create_mode, sequenced_task_runner); |
266 } | 266 } |
267 | 267 |
268 // static | 268 // static |
269 int ProfileImpl::create_readme_delay_ms = 60000; | 269 int ProfileImpl::create_readme_delay_ms = 60000; |
270 | 270 |
271 // static | 271 // static |
272 const char* const ProfileImpl::kPrefExitTypeNormal = "Normal"; | 272 const char* const ProfileImpl::kPrefExitTypeNormal = "Normal"; |
273 | 273 |
274 // static | 274 // static |
275 void ProfileImpl::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 275 void ProfileImpl::RegisterUserPrefs( |
276 registry->RegisterBooleanPref(prefs::kSavingBrowserHistoryDisabled, | 276 user_prefs::PrefRegistrySyncable* registry) { |
277 false, | 277 registry->RegisterBooleanPref( |
278 PrefRegistrySyncable::UNSYNCABLE_PREF); | 278 prefs::kSavingBrowserHistoryDisabled, |
279 registry->RegisterBooleanPref(prefs::kAllowDeletingBrowserHistory, | 279 false, |
280 true, | 280 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
281 PrefRegistrySyncable::UNSYNCABLE_PREF); | 281 registry->RegisterBooleanPref( |
282 registry->RegisterBooleanPref(prefs::kSigninAllowed, | 282 prefs::kAllowDeletingBrowserHistory, |
283 true, | 283 true, |
284 PrefRegistrySyncable::UNSYNCABLE_PREF); | 284 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
285 registry->RegisterBooleanPref(prefs::kForceSafeSearch, | 285 registry->RegisterBooleanPref( |
286 false, | 286 prefs::kSigninAllowed, |
287 PrefRegistrySyncable::UNSYNCABLE_PREF); | 287 true, |
288 registry->RegisterIntegerPref(prefs::kProfileAvatarIndex, | 288 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
289 -1, | 289 registry->RegisterBooleanPref( |
290 PrefRegistrySyncable::SYNCABLE_PREF); | 290 prefs::kForceSafeSearch, |
291 registry->RegisterStringPref( | 291 false, |
292 prefs::kProfileName, std::string(), PrefRegistrySyncable::SYNCABLE_PREF); | 292 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
293 registry->RegisterBooleanPref(prefs::kProfileIsManaged, | 293 registry->RegisterIntegerPref( |
294 false, | 294 prefs::kProfileAvatarIndex, |
295 PrefRegistrySyncable::SYNCABLE_PREF); | 295 -1, |
| 296 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 297 registry->RegisterStringPref(prefs::kProfileName, |
| 298 std::string(), |
| 299 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 300 registry->RegisterBooleanPref( |
| 301 prefs::kProfileIsManaged, |
| 302 false, |
| 303 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
296 registry->RegisterStringPref(prefs::kHomePage, | 304 registry->RegisterStringPref(prefs::kHomePage, |
297 std::string(), | 305 std::string(), |
298 PrefRegistrySyncable::SYNCABLE_PREF); | 306 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
299 #if defined(ENABLE_PRINTING) | 307 #if defined(ENABLE_PRINTING) |
300 registry->RegisterBooleanPref(prefs::kPrintingEnabled, | 308 registry->RegisterBooleanPref( |
301 true, | 309 prefs::kPrintingEnabled, |
302 PrefRegistrySyncable::UNSYNCABLE_PREF); | 310 true, |
| 311 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
303 #endif | 312 #endif |
304 registry->RegisterBooleanPref(prefs::kPrintPreviewDisabled, | 313 registry->RegisterBooleanPref( |
| 314 prefs::kPrintPreviewDisabled, |
305 #if defined(GOOGLE_CHROME_BUILD) | 315 #if defined(GOOGLE_CHROME_BUILD) |
306 false, | 316 false, |
307 #else | 317 #else |
308 true, | 318 true, |
309 #endif | 319 #endif |
310 PrefRegistrySyncable::UNSYNCABLE_PREF); | 320 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
311 | 321 |
312 // Initialize the cache prefs. | 322 // Initialize the cache prefs. |
313 registry->RegisterFilePathPref(prefs::kDiskCacheDir, | 323 registry->RegisterFilePathPref( |
314 base::FilePath(), | 324 prefs::kDiskCacheDir, |
315 PrefRegistrySyncable::UNSYNCABLE_PREF); | 325 base::FilePath(), |
316 registry->RegisterIntegerPref(prefs::kDiskCacheSize, | 326 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
317 0, | 327 registry->RegisterIntegerPref( |
318 PrefRegistrySyncable::UNSYNCABLE_PREF); | 328 prefs::kDiskCacheSize, |
319 registry->RegisterIntegerPref(prefs::kMediaCacheSize, | 329 0, |
320 0, | 330 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
321 PrefRegistrySyncable::UNSYNCABLE_PREF); | 331 registry->RegisterIntegerPref( |
| 332 prefs::kMediaCacheSize, |
| 333 0, |
| 334 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
322 | 335 |
323 // Deprecated. Kept around for migration. | 336 // Deprecated. Kept around for migration. |
324 registry->RegisterBooleanPref(prefs::kClearSiteDataOnExit, | 337 registry->RegisterBooleanPref( |
325 false, | 338 prefs::kClearSiteDataOnExit, |
326 PrefRegistrySyncable::SYNCABLE_PREF); | 339 false, |
| 340 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
327 } | 341 } |
328 | 342 |
329 ProfileImpl::ProfileImpl( | 343 ProfileImpl::ProfileImpl( |
330 const base::FilePath& path, | 344 const base::FilePath& path, |
331 Delegate* delegate, | 345 Delegate* delegate, |
332 CreateMode create_mode, | 346 CreateMode create_mode, |
333 base::SequencedTaskRunner* sequenced_task_runner) | 347 base::SequencedTaskRunner* sequenced_task_runner) |
334 : zoom_callback_(base::Bind(&ProfileImpl::OnZoomLevelChanged, | 348 : zoom_callback_(base::Bind(&ProfileImpl::OnZoomLevelChanged, |
335 base::Unretained(this))), | 349 base::Unretained(this))), |
336 path_(path), | 350 path_(path), |
337 pref_registry_(new PrefRegistrySyncable), | 351 pref_registry_(new user_prefs::PrefRegistrySyncable), |
338 io_data_(this), | 352 io_data_(this), |
339 host_content_settings_map_(NULL), | 353 host_content_settings_map_(NULL), |
340 last_session_exit_type_(EXIT_NORMAL), | 354 last_session_exit_type_(EXIT_NORMAL), |
341 start_time_(Time::Now()), | 355 start_time_(Time::Now()), |
342 delegate_(delegate), | 356 delegate_(delegate), |
343 predictor_(NULL) { | 357 predictor_(NULL) { |
344 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << | 358 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
345 "profile files to the root directory!"; | 359 "profile files to the root directory!"; |
346 | 360 |
347 #if defined(ENABLE_SESSION_SERVICE) | 361 #if defined(ENABLE_SESSION_SERVICE) |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 base::FilePath* cache_path, | 1135 base::FilePath* cache_path, |
1122 int* max_size) { | 1136 int* max_size) { |
1123 DCHECK(cache_path); | 1137 DCHECK(cache_path); |
1124 DCHECK(max_size); | 1138 DCHECK(max_size); |
1125 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1139 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1126 if (!path.empty()) | 1140 if (!path.empty()) |
1127 *cache_path = path; | 1141 *cache_path = path; |
1128 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1142 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1129 prefs_->GetInteger(prefs::kDiskCacheSize); | 1143 prefs_->GetInteger(prefs::kDiskCacheSize); |
1130 } | 1144 } |
OLD | NEW |