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

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

Issue 12670013: Out-of-process import on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r196136 + modifications in extracted CLs Created 7 years, 8 months 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) 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_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 for (it = active_profiles_.begin(); it != active_profiles_.end(); ++it) { 744 for (it = active_profiles_.begin(); it != active_profiles_.end(); ++it) {
745 std::string profile_path = (*it)->GetPath().BaseName().MaybeAsASCII(); 745 std::string profile_path = (*it)->GetPath().BaseName().MaybeAsASCII();
746 if (profile_paths.find(profile_path) == profile_paths.end()) { 746 if (profile_paths.find(profile_path) == profile_paths.end()) {
747 profile_paths.insert(profile_path); 747 profile_paths.insert(profile_path);
748 profile_list->Append(new StringValue(profile_path)); 748 profile_list->Append(new StringValue(profile_path));
749 } 749 }
750 } 750 }
751 } 751 }
752 } 752 }
753 753
754 // static
755 bool ProfileManager::IsImportProcess(const CommandLine& command_line) {
756 return (command_line.HasSwitch(switches::kImport) ||
757 command_line.HasSwitch(switches::kImportFromFile));
758 }
759
760 void ProfileManager::SetWillImport() { 754 void ProfileManager::SetWillImport() {
761 will_import_ = true; 755 will_import_ = true;
762 } 756 }
763 757
764 void ProfileManager::OnImportFinished(Profile* profile) { 758 void ProfileManager::OnImportFinished(Profile* profile) {
765 will_import_ = false; 759 will_import_ = false;
766 DCHECK(profile); 760 DCHECK(profile);
767 761
768 #if !defined(OS_CHROMEOS) 762 #if !defined(OS_CHROMEOS)
769 // If the import process was not run, it means this branch was not called, 763 // If the import process was not run, it means this branch was not called,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 ProfileMetrics::LogNumberOfProfiles(this); 819 ProfileMetrics::LogNumberOfProfiles(this);
826 content::NotificationService::current()->Notify( 820 content::NotificationService::current()->Notify(
827 chrome::NOTIFICATION_PROFILE_ADDED, 821 chrome::NOTIFICATION_PROFILE_ADDED,
828 content::Source<Profile>(profile), 822 content::Source<Profile>(profile),
829 content::NotificationService::NoDetails()); 823 content::NotificationService::NoDetails());
830 } 824 }
831 825
832 void ProfileManager::DoFinalInitForServices(Profile* profile, 826 void ProfileManager::DoFinalInitForServices(Profile* profile,
833 bool go_off_the_record) { 827 bool go_off_the_record) {
834 #if defined(ENABLE_EXTENSIONS) 828 #if defined(ENABLE_EXTENSIONS)
835 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 829 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
836 if (!IsImportProcess(command_line)) { 830 !go_off_the_record);
837 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( 831 // During tests, when |profile| is an instance of TestingProfile,
838 !go_off_the_record); 832 // ExtensionSystem might not create an ExtensionService.
839 // During tests, when |profile| is an instance of TestingProfile, 833 if (extensions::ExtensionSystem::Get(profile)->extension_service()) {
840 // ExtensionSystem might not create an ExtensionService. 834 profile->GetHostContentSettingsMap()->RegisterExtensionService(
841 if (extensions::ExtensionSystem::Get(profile)->extension_service()) { 835 extensions::ExtensionSystem::Get(profile)->extension_service());
842 profile->GetHostContentSettingsMap()->RegisterExtensionService(
843 extensions::ExtensionSystem::Get(profile)->extension_service());
844 }
845 } 836 }
846 #endif 837 #endif
847 #if defined(ENABLE_MANAGED_USERS) 838 #if defined(ENABLE_MANAGED_USERS)
848 // Initialization needs to happen after extension system initialization (for 839 // Initialization needs to happen after extension system initialization (for
849 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the 840 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the
850 // initializing the managed flag if necessary). 841 // initializing the managed flag if necessary).
851 ManagedUserServiceFactory::GetForProfile(profile)->Init(); 842 ManagedUserServiceFactory::GetForProfile(profile)->Init();
852 #endif 843 #endif
853 // Start the deferred task runners once the profile is loaded. 844 // Start the deferred task runners once the profile is loaded.
854 StartupTaskRunnerServiceFactory::GetForProfile(profile)-> 845 StartupTaskRunnerServiceFactory::GetForProfile(profile)->
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 ProfileManager::ProfileInfo::ProfileInfo( 1193 ProfileManager::ProfileInfo::ProfileInfo(
1203 Profile* profile, 1194 Profile* profile,
1204 bool created) 1195 bool created)
1205 : profile(profile), 1196 : profile(profile),
1206 created(created) { 1197 created(created) {
1207 } 1198 }
1208 1199
1209 ProfileManager::ProfileInfo::~ProfileInfo() { 1200 ProfileManager::ProfileInfo::~ProfileInfo() {
1210 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1201 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1211 } 1202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698