| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 PrefService* local_state = g_browser_process->local_state(); | 458 PrefService* local_state = g_browser_process->local_state(); |
| 459 DCHECK(local_state); | 459 DCHECK(local_state); |
| 460 // Only keep track of profiles that we are managing; tests may create others. | 460 // Only keep track of profiles that we are managing; tests may create others. |
| 461 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { | 461 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { |
| 462 local_state->SetString(prefs::kProfileLastUsed, | 462 local_state->SetString(prefs::kProfileLastUsed, |
| 463 last_active->GetPath().BaseName().MaybeAsASCII()); | 463 last_active->GetPath().BaseName().MaybeAsASCII()); |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { | 467 void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { |
| 468 DoFinalInitForServices(profile, go_off_the_record); |
| 469 AddProfileToCache(profile); |
| 470 DoFinalInitLogging(profile); |
| 471 } |
| 472 |
| 473 void ProfileManager::DoFinalInitForServices(Profile* profile, |
| 474 bool go_off_the_record) { |
| 468 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 475 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 469 profile->InitExtensions(!go_off_the_record); | 476 profile->InitExtensions(!go_off_the_record); |
| 470 if (!command_line.HasSwitch(switches::kDisableWebResources)) | 477 if (!command_line.HasSwitch(switches::kDisableWebResources)) |
| 471 profile->InitPromoResources(); | 478 profile->InitPromoResources(); |
| 472 AddProfileToCache(profile); | 479 } |
| 473 | 480 |
| 481 void ProfileManager::DoFinalInitLogging(Profile* profile) { |
| 474 // Log the profile size after a reasonable startup delay. | 482 // Log the profile size after a reasonable startup delay. |
| 475 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, | 483 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, |
| 476 new ProfileSizeTask(profile), 112000); | 484 new ProfileSizeTask(profile), 112000); |
| 477 } | 485 } |
| 478 | 486 |
| 479 Profile* ProfileManager::CreateProfile(const FilePath& path) { | 487 Profile* ProfileManager::CreateProfile(const FilePath& path) { |
| 480 return Profile::CreateProfile(path); | 488 return Profile::CreateProfile(path); |
| 481 } | 489 } |
| 482 | 490 |
| 483 void ProfileManager::OnProfileCreated(Profile* profile, bool success) { | 491 void ProfileManager::OnProfileCreated(Profile* profile, bool success) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 677 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 670 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 678 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 671 } | 679 } |
| 672 | 680 |
| 673 void ProfileManager::RegisterTestingProfile(Profile* profile, | 681 void ProfileManager::RegisterTestingProfile(Profile* profile, |
| 674 bool add_to_cache) { | 682 bool add_to_cache) { |
| 675 RegisterProfile(profile, true); | 683 RegisterProfile(profile, true); |
| 676 if (add_to_cache) | 684 if (add_to_cache) |
| 677 AddProfileToCache(profile); | 685 AddProfileToCache(profile); |
| 678 } | 686 } |
| OLD | NEW |