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