| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/policy/user_policy_manager_factory_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const bool is_browser_restart = | 197 const bool is_browser_restart = |
| 198 command_line->HasSwitch(chromeos::switches::kLoginUser); | 198 command_line->HasSwitch(chromeos::switches::kLoginUser); |
| 199 const user_manager::UserManager* const user_manager = | 199 const user_manager::UserManager* const user_manager = |
| 200 user_manager::UserManager::Get(); | 200 user_manager::UserManager::Get(); |
| 201 | 201 |
| 202 // We want to block for policy in a few situations: if the user is new, or if | 202 // We want to block for policy in a few situations: if the user is new, or if |
| 203 // we are forcing an online signin. An online signin will be forced if there | 203 // we are forcing an online signin. An online signin will be forced if there |
| 204 // has been a credential error, or if the initial session creation was not | 204 // has been a credential error, or if the initial session creation was not |
| 205 // completed (the oauth_token_status is not set to valid by OAuth2LoginManager | 205 // completed (the oauth_token_status is not set to valid by OAuth2LoginManager |
| 206 // until profile creation/session restore is complete). | 206 // until profile creation/session restore is complete). |
| 207 // TODO(tnagel): Don't limit blocking to cloud managed users. | |
| 208 const bool block_forever_for_policy = | 207 const bool block_forever_for_policy = |
| 209 !is_active_directory && !user_manager->IsLoggedInAsStub() && | 208 !user_manager->IsLoggedInAsStub() && |
| 210 (user_manager->IsCurrentUserNew() || | 209 (user_manager->IsCurrentUserNew() || |
| 211 user_manager->GetActiveUser()->force_online_signin() || | 210 user_manager->GetActiveUser()->force_online_signin() || |
| 212 user_manager->GetActiveUser()->oauth_token_status() != | 211 user_manager->GetActiveUser()->oauth_token_status() != |
| 213 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 212 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
| 214 | 213 |
| 215 const bool wait_for_policy_fetch = | 214 const bool wait_for_policy_fetch = |
| 216 block_forever_for_policy || !is_browser_restart; | 215 block_forever_for_policy || !is_browser_restart; |
| 217 | 216 |
| 218 base::TimeDelta initial_policy_fetch_timeout; | 217 base::TimeDelta initial_policy_fetch_timeout; |
| 219 if (block_forever_for_policy) { | 218 if (block_forever_for_policy) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 325 |
| 327 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory( | 326 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory( |
| 328 content::BrowserContext* context) { | 327 content::BrowserContext* context) { |
| 329 return false; | 328 return false; |
| 330 } | 329 } |
| 331 | 330 |
| 332 void UserPolicyManagerFactoryChromeOS::CreateServiceNow( | 331 void UserPolicyManagerFactoryChromeOS::CreateServiceNow( |
| 333 content::BrowserContext* context) {} | 332 content::BrowserContext* context) {} |
| 334 | 333 |
| 335 } // namespace policy | 334 } // namespace policy |
| OLD | NEW |