Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 8502031: Refactor ProfileManager::DoFinalInit(...) to allow for a more flexible ProfileManagerWithoutInit.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 DoFinalServicesInit(profile, go_off_the_record);
469 AddProfileToCache(profile);
470
Robert Sesek 2011/11/09 19:07:46 nit: remove
471 DoFinalInitLogging(profile);
472 }
473
474 void ProfileManager::DoFinalServicesInit(Profile* profile,
475 bool go_off_the_record) {
468 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 476 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
469 profile->InitExtensions(!go_off_the_record); 477 profile->InitExtensions(!go_off_the_record);
470 if (!command_line.HasSwitch(switches::kDisableWebResources)) 478 if (!command_line.HasSwitch(switches::kDisableWebResources))
471 profile->InitPromoResources(); 479 profile->InitPromoResources();
472 AddProfileToCache(profile); 480 }
473 481
482 void ProfileManager::DoFinalInitLogging(Profile* profile) {
474 // Log the profile size after a reasonable startup delay. 483 // Log the profile size after a reasonable startup delay.
475 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, 484 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE,
476 new ProfileSizeTask(profile), 112000); 485 new ProfileSizeTask(profile), 112000);
477 } 486 }
478 487
479 Profile* ProfileManager::CreateProfile(const FilePath& path) { 488 Profile* ProfileManager::CreateProfile(const FilePath& path) {
480 return Profile::CreateProfile(path); 489 return Profile::CreateProfile(path);
481 } 490 }
482 491
483 void ProfileManager::OnProfileCreated(Profile* profile, bool success) { 492 void ProfileManager::OnProfileCreated(Profile* profile, bool success) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 678 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
670 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { 679 const FilePath& user_data_dir) : ProfileManager(user_data_dir) {
671 } 680 }
672 681
673 void ProfileManager::RegisterTestingProfile(Profile* profile, 682 void ProfileManager::RegisterTestingProfile(Profile* profile,
674 bool add_to_cache) { 683 bool add_to_cache) {
675 RegisterProfile(profile, true); 684 RegisterProfile(profile, true);
676 if (add_to_cache) 685 if (add_to_cache)
677 AddProfileToCache(profile); 686 AddProfileToCache(profile);
678 } 687 }
OLDNEW
« chrome/browser/profiles/profile_manager.h ('K') | « chrome/browser/profiles/profile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698