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

Unified Diff: chrome/browser/policy/user_policy_signin_service.cc

Issue 12692006: Merge 186990 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/user_policy_signin_service.cc
===================================================================
--- chrome/browser/policy/user_policy_signin_service.cc (revision 187380)
+++ chrome/browser/policy/user_policy_signin_service.cc (working copy)
@@ -248,6 +248,12 @@
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_ADDED,
content::Source<Profile>(profile));
+
+ // Register a listener for the import finished notification in a first run
+ // scenario, which indicates the profile is ready to be further initialized.
+ registrar_.Add(this,
+ chrome::NOTIFICATION_IMPORT_FINISHED,
+ content::Source<Profile>(profile));
}
UserPolicySigninService::~UserPolicySigninService() {}
@@ -342,6 +348,16 @@
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ // If an import process is running, wait for NOTIFICATION_IMPORT_FINISHED
+ // before potentially creating the SigninManager. Its dependencies can access
+ // databases that the import process is also accessing, causing conflicts.
+ // Note that the profile manager is NULL in unit tests.
+ if (g_browser_process->profile_manager() &&
+ g_browser_process->profile_manager()->will_import()) {
+ DCHECK_EQ(chrome::NOTIFICATION_PROFILE_ADDED, type);
+ return;
+ }
+
// If using a TestingProfile with no SigninManager or UserCloudPolicyManager,
// skip initialization.
if (!GetManager() || !SigninManagerFactory::GetForProfile(profile_)) {
@@ -353,6 +369,7 @@
case chrome::NOTIFICATION_GOOGLE_SIGNED_OUT:
ShutdownUserCloudPolicyManager();
break;
+ case chrome::NOTIFICATION_IMPORT_FINISHED:
case chrome::NOTIFICATION_PROFILE_ADDED: {
// A new profile has been loaded - if it's signed in, then initialize the
// UCPM, otherwise shut down the UCPM (which deletes any cached policy
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698