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

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: Added 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 in a few situations: if the user is new, or if
emaxx 2017/02/23 21:45:25 nit: The comment should be updated to correspond t
Andrew T Wilson (Slow) 2017/02/24 16:15:15 Done.
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 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->IsCurrentUserNew() ||
emaxx 2017/02/23 21:45:25 IIUC, IsCurrentUserNew() returns true for ephemera
Andrew T Wilson (Slow) 2017/02/24 16:15:15 Good point, I'll remove the check for new user as
210 user_manager->GetActiveUser()->force_online_signin() || 210 !user_manager->GetActiveUser()->session_initialized());
211 user_manager->GetActiveUser()->oauth_token_status() !=
212 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
213 211
214 const bool wait_for_policy_fetch = 212 const bool wait_for_policy_fetch =
215 block_forever_for_policy || !is_browser_restart; 213 block_forever_for_policy || !is_browser_restart;
216 214
217 base::TimeDelta initial_policy_fetch_timeout; 215 base::TimeDelta initial_policy_fetch_timeout;
218 if (block_forever_for_policy) { 216 if (block_forever_for_policy) {
219 initial_policy_fetch_timeout = base::TimeDelta::Max(); 217 initial_policy_fetch_timeout = base::TimeDelta::Max();
220 } else if (wait_for_policy_fetch) { 218 } else if (wait_for_policy_fetch) {
221 initial_policy_fetch_timeout = 219 initial_policy_fetch_timeout =
222 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds); 220 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 323
326 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory( 324 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory(
327 content::BrowserContext* context) { 325 content::BrowserContext* context) {
328 return false; 326 return false;
329 } 327 }
330 328
331 void UserPolicyManagerFactoryChromeOS::CreateServiceNow( 329 void UserPolicyManagerFactoryChromeOS::CreateServiceNow(
332 content::BrowserContext* context) {} 330 content::BrowserContext* context) {}
333 331
334 } // namespace policy 332 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698