Chromium Code Reviews| Index: chrome/browser/chromeos/login/login_utils.cc |
| diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc |
| index 2feb04c21c0f9c7234a8bcff381e621c018d0756..94d734fd2abb59bffe46a61f2e228af13019ffc3 100644 |
| --- a/chrome/browser/chromeos/login/login_utils.cc |
| +++ b/chrome/browser/chromeos/login/login_utils.cc |
| @@ -326,6 +326,9 @@ void LoginUtilsImpl::PrepareProfile( |
| VLOG(1) << "Completing login for " << user_context.username; |
| + // TODO(nkostylev): Eliminate this flag. |
| + bool is_primary_user = !UserManager::Get()->IsUserLoggedIn(); |
|
Dmitry Polukhin
2013/04/11 13:34:15
Please move definition closer to use.
Nikita (slow)
2013/04/12 15:41:25
Done.
|
| + |
| btl->AddLoginTimeMarker("StartSession-Start", false); |
| DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( |
| user_context.username); |
| @@ -353,29 +356,35 @@ void LoginUtilsImpl::PrepareProfile( |
| delegate_ = delegate; |
| InitSessionRestoreStrategy(); |
| - policy::BrowserPolicyConnector* connector = |
| - g_browser_process->browser_policy_connector(); |
| - |
| - // If this is an enterprise device and the user belongs to the enterprise |
| - // domain, then wait for a policy fetch before logging the user in. This |
| - // will delay Profile creation until the policy is fetched, so that features |
| - // controlled by policy (e.g. Sync, Startup tabs) only start after the |
| - // PrefService has the right values. |
| - // Profile creation is also resumed if the fetch attempt fails. |
| - bool wait_for_policy_fetch = |
| - using_oauth_ && |
| - authenticator_.get() && |
| - (connector->GetUserAffiliation(user_context_.username) == |
| - policy::USER_AFFILIATION_MANAGED); |
| - |
| - // Initialize user policy before the profile is created so the profile |
| - // initialization code sees the cached policy settings. |
| - connector->InitializeUserPolicy(user_context_.username, |
| - user_manager->IsLoggedInAsPublicAccount(), |
| - wait_for_policy_fetch); |
| + bool wait_for_policy_fetch = false; |
| + |
| + // TODO(nkostylev): Figure out implementation for multiple-profiles. |
| + if (is_primary_user) { |
| + policy::BrowserPolicyConnector* connector = |
| + g_browser_process->browser_policy_connector(); |
| + |
| + // If this is an enterprise device and the user belongs to the enterprise |
| + // domain, then wait for a policy fetch before logging the user in. This |
| + // will delay Profile creation until the policy is fetched, so that features |
| + // controlled by policy (e.g. Sync, Startup tabs) only start after the |
| + // PrefService has the right values. |
| + // Profile creation is also resumed if the fetch attempt fails. |
| + wait_for_policy_fetch = |
| + using_oauth_ && |
| + authenticator_.get() && |
| + (connector->GetUserAffiliation(user_context_.username) == |
| + policy::USER_AFFILIATION_MANAGED); |
| + |
| + // Initialize user policy before the profile is created so the profile |
| + // initialization code sees the cached policy settings. |
| + connector->InitializeUserPolicy(user_context_.username, |
| + user_manager->IsLoggedInAsPublicAccount(), |
| + wait_for_policy_fetch); |
| + } |
| // The default profile will have been changed because the ProfileManager |
| - // will process the notification that the UserManager sends out. |
| + // will process the notification that the UserManager sends out so |
| + // username_hash has been already propogated to ProfileManager. |
| ProfileManager::CreateDefaultProfileAsync( |
| base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr())); |