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

Side by Side Diff: chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.cc

Issue 2711113003: Track whether a given user session has completed initialization, and use (Closed)
Patch Set: Only expose known_user::RemovePrefsForTesting() for tests Created 3 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 unified diff | Download patch
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 is_active_directory = true; 193 is_active_directory = true;
194 break; 194 break;
195 } 195 }
196 196
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 if the session has never been initialized
203 // we are forcing an online signin. An online signin will be forced if there 203 // (generally true if the user is new, or if there was a crash before the
204 // has been a credential error, or if the initial session creation was not 204 // profile finished initializing). There is code in UserSelectionScreen to
205 // completed (the oauth_token_status is not set to valid by OAuth2LoginManager 205 // force an online signin for uninitialized sessions to help ensure we are
206 // until profile creation/session restore is complete). 206 // able to load policy.
207 const bool block_forever_for_policy = 207 const bool block_forever_for_policy =
208 !user_manager->IsLoggedInAsStub() && 208 !user_manager->IsLoggedInAsStub() &&
209 (user_manager->IsCurrentUserNew() || 209 !user_manager->GetActiveUser()->profile_ever_initialized();
210 user_manager->GetActiveUser()->force_online_signin() ||
211 user_manager->GetActiveUser()->oauth_token_status() !=
212 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
213 210
214 const bool wait_for_policy_fetch = 211 const bool wait_for_policy_fetch =
215 block_forever_for_policy || !is_browser_restart; 212 block_forever_for_policy || !is_browser_restart;
216 213
217 base::TimeDelta initial_policy_fetch_timeout; 214 base::TimeDelta initial_policy_fetch_timeout;
218 if (block_forever_for_policy) { 215 if (block_forever_for_policy) {
219 initial_policy_fetch_timeout = base::TimeDelta::Max(); 216 initial_policy_fetch_timeout = base::TimeDelta::Max();
220 } else if (wait_for_policy_fetch) { 217 } else if (wait_for_policy_fetch) {
221 initial_policy_fetch_timeout = 218 initial_policy_fetch_timeout =
222 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds); 219 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 322
326 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory( 323 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory(
327 content::BrowserContext* context) { 324 content::BrowserContext* context) {
328 return false; 325 return false;
329 } 326 }
330 327
331 void UserPolicyManagerFactoryChromeOS::CreateServiceNow( 328 void UserPolicyManagerFactoryChromeOS::CreateServiceNow(
332 content::BrowserContext* context) {} 329 content::BrowserContext* context) {}
333 330
334 } // namespace policy 331 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/user_manager_unittest.cc ('k') | chrome/browser/profiles/profile_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698