Index: chrome/browser/profiles/profile_keyed_base_factory.cc |
diff --git a/chrome/browser/profiles/profile_keyed_base_factory.cc b/chrome/browser/profiles/profile_keyed_base_factory.cc |
index 7f52e3d0c9b4303f1977692b4abb42c520033028..5013f90edc0097bafeada42fbba7f3d71f9fdb7f 100644 |
--- a/chrome/browser/profiles/profile_keyed_base_factory.cc |
+++ b/chrome/browser/profiles/profile_keyed_base_factory.cc |
@@ -4,9 +4,11 @@ |
#include "chrome/browser/profiles/profile_keyed_base_factory.h" |
+#include "base/command_line.h" |
#include "base/prefs/pref_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_dependency_manager.h" |
+#include "chrome/browser/profiles/profile_manager.h" |
#include "components/user_prefs/pref_registry_syncable.h" |
ProfileKeyedBaseFactory::ProfileKeyedBaseFactory( |
@@ -49,6 +51,14 @@ Profile* ProfileKeyedBaseFactory::GetProfileToUse(Profile* profile) { |
} |
} |
+ // If this is the import process, most services are not created to avoid |
+ // conflicts with non-shareable resources used by the same service running in |
+ // the browser process. |
+ if (ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess()) && |
+ ServiceIsNULLOnImportProcess()) { |
+ return NULL; |
+ } |
+ |
return profile; |
} |
@@ -102,6 +112,10 @@ bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const { |
return false; |
} |
+bool ProfileKeyedBaseFactory::ServiceIsNULLOnImportProcess() const { |
+ return true; |
+} |
+ |
void ProfileKeyedBaseFactory::ProfileDestroyed(Profile* profile) { |
// While object destruction can be customized in ways where the object is |
// only dereferenced, this still must run on the UI thread. |