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

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
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698