| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 // static | 223 // static |
| 224 void ProfileImpl::RegisterUserPrefs(PrefService* prefs) { | 224 void ProfileImpl::RegisterUserPrefs(PrefService* prefs) { |
| 225 prefs->RegisterBooleanPref(prefs::kSavingBrowserHistoryDisabled, | 225 prefs->RegisterBooleanPref(prefs::kSavingBrowserHistoryDisabled, |
| 226 false, | 226 false, |
| 227 PrefService::UNSYNCABLE_PREF); | 227 PrefService::UNSYNCABLE_PREF); |
| 228 prefs->RegisterBooleanPref(prefs::kClearSiteDataOnExit, | 228 prefs->RegisterBooleanPref(prefs::kClearSiteDataOnExit, |
| 229 false, | 229 false, |
| 230 PrefService::SYNCABLE_PREF); | 230 PrefService::SYNCABLE_PREF); |
| 231 prefs->RegisterBooleanPref(prefs::kProfileShortcutCreated, |
| 232 false, |
| 233 PrefService::UNSYNCABLE_PREF); |
| 231 prefs->RegisterIntegerPref(prefs::kProfileAvatarIndex, | 234 prefs->RegisterIntegerPref(prefs::kProfileAvatarIndex, |
| 232 -1, | 235 -1, |
| 233 PrefService::SYNCABLE_PREF); | 236 PrefService::SYNCABLE_PREF); |
| 234 prefs->RegisterStringPref(prefs::kProfileName, | 237 prefs->RegisterStringPref(prefs::kProfileName, |
| 235 "", | 238 "", |
| 236 PrefService::SYNCABLE_PREF); | 239 PrefService::SYNCABLE_PREF); |
| 237 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 240 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
| 238 prefs->RegisterIntegerPref(prefs::kLocalProfileId, | 241 prefs->RegisterIntegerPref(prefs::kLocalProfileId, |
| 239 kInvalidLocalProfileId, | 242 kInvalidLocalProfileId, |
| 240 PrefService::UNSYNCABLE_PREF); | 243 PrefService::UNSYNCABLE_PREF); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (!file_util::CreateDirectory(base_cache_path_)) | 324 if (!file_util::CreateDirectory(base_cache_path_)) |
| 322 LOG(FATAL) << "Failed to create " << base_cache_path_.value(); | 325 LOG(FATAL) << "Failed to create " << base_cache_path_.value(); |
| 323 } else { | 326 } else { |
| 324 // Async profile loading is used, so call this on the FILE thread instead. | 327 // Async profile loading is used, so call this on the FILE thread instead. |
| 325 // It is safe since all other file operations should also be done there. | 328 // It is safe since all other file operations should also be done there. |
| 326 BrowserThread::PostTask( | 329 BrowserThread::PostTask( |
| 327 BrowserThread::FILE, FROM_HERE, | 330 BrowserThread::FILE, FROM_HERE, |
| 328 base::Bind(&CreateDirectoryNoResult, base_cache_path_)); | 331 base::Bind(&CreateDirectoryNoResult, base_cache_path_)); |
| 329 } | 332 } |
| 330 | 333 |
| 331 // Now that the profile is hooked up to recieve pref change notifications to | 334 // Now that the profile is hooked up to receive pref change notifications to |
| 332 // kGoogleServicesUsername, initialize components that depend on it to reflect | 335 // kGoogleServicesUsername, initialize components that depend on it to reflect |
| 333 // the current value. | 336 // the current value. |
| 334 UpdateProfileUserNameCache(); | 337 UpdateProfileUserNameCache(); |
| 335 GetGAIAInfoUpdateService(); | 338 GetGAIAInfoUpdateService(); |
| 336 | 339 |
| 337 #if !defined(OS_CHROMEOS) | 340 #if !defined(OS_CHROMEOS) |
| 338 // Listen for bookmark model load, to bootstrap the sync service. | 341 // Listen for bookmark model load, to bootstrap the sync service. |
| 339 // On CrOS sync service will be initialized after sign in. | 342 // On CrOS sync service will be initialized after sign in. |
| 340 registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, | 343 registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, |
| 341 content::Source<Profile>(this)); | 344 content::Source<Profile>(this)); |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 FilePath* cache_path, | 1682 FilePath* cache_path, |
| 1680 int* max_size) { | 1683 int* max_size) { |
| 1681 DCHECK(cache_path); | 1684 DCHECK(cache_path); |
| 1682 DCHECK(max_size); | 1685 DCHECK(max_size); |
| 1683 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1686 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1684 if (!path.empty()) | 1687 if (!path.empty()) |
| 1685 *cache_path = path; | 1688 *cache_path = path; |
| 1686 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1689 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1687 prefs_->GetInteger(prefs::kDiskCacheSize); | 1690 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1688 } | 1691 } |
| OLD | NEW |