| Index: chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
|
| diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
|
| index 3fad89c8d58aec3308c9882584fe9d1e41036e46..7695acf10fe0e0746f95c5372417f2a38eb993e7 100644
|
| --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
|
| +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
|
| @@ -149,16 +149,35 @@ scoped_ptr<UserCloudPolicyManagerChromeOS>
|
| g_browser_process->platform_part()->browser_policy_connector_chromeos();
|
| const bool is_browser_restart =
|
| command_line->HasSwitch(chromeos::switches::kLoginUser);
|
| - const bool wait_for_initial_policy = !is_browser_restart;
|
| -
|
| - const base::TimeDelta initial_policy_fetch_timeout =
|
| - user_manager::UserManager::Get()->IsCurrentUserNew()
|
| - ? base::TimeDelta::Max()
|
| - : base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds);
|
| + const user_manager::UserManager* const user_manager =
|
| + user_manager::UserManager::Get();
|
| +
|
| + // We want to block for policy in a few situations: if the user is new, or
|
| + // if we are forcing an online signin. An online signin will be forced if
|
| + // there has been a credential error, or if the initial session creation
|
| + // was not completed (the oauth_token_status is not set to valid by
|
| + // OAuth2LoginManager until profile creation/session restore is complete).
|
| + const bool block_forever_for_policy =
|
| + !user_manager->IsLoggedInAsStub() &&
|
| + (user_manager->IsCurrentUserNew() ||
|
| + user_manager->GetActiveUser()->force_online_signin() ||
|
| + user_manager->GetActiveUser()->oauth_token_status() !=
|
| + user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
|
| +
|
| + const bool wait_for_policy_fetch =
|
| + block_forever_for_policy || !is_browser_restart;
|
| +
|
| + base::TimeDelta initial_policy_fetch_timeout;
|
| + if (block_forever_for_policy) {
|
| + initial_policy_fetch_timeout = base::TimeDelta::Max();
|
| + } else if (wait_for_policy_fetch) {
|
| + initial_policy_fetch_timeout =
|
| + base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds);
|
| + }
|
|
|
| DeviceManagementService* device_management_service =
|
| connector->device_management_service();
|
| - if (wait_for_initial_policy)
|
| + if (wait_for_policy_fetch)
|
| device_management_service->ScheduleInitialization(0);
|
|
|
| base::FilePath profile_dir = profile->GetPath();
|
| @@ -201,7 +220,7 @@ scoped_ptr<UserCloudPolicyManagerChromeOS>
|
| scoped_ptr<UserCloudPolicyManagerChromeOS> manager(
|
| new UserCloudPolicyManagerChromeOS(
|
| std::move(store), std::move(external_data_manager),
|
| - component_policy_cache_dir, wait_for_initial_policy,
|
| + component_policy_cache_dir, wait_for_policy_fetch,
|
| initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(),
|
| file_task_runner, io_task_runner));
|
|
|
|
|