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

Side by Side Diff: chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.cc

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/login/saml/saml_offline_signin_limiter.h" 5 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 NOTREACHED(); 48 NOTREACHED();
49 return; 49 return;
50 } 50 }
51 const std::string& user_id = user->email(); 51 const std::string& user_id = user->email();
52 52
53 if (auth_flow == UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML) { 53 if (auth_flow == UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML) {
54 // The user went through online authentication and GAIA did not redirect to 54 // The user went through online authentication and GAIA did not redirect to
55 // a SAML IdP. No limit applies in this case. Clear the time of last login 55 // a SAML IdP. No limit applies in this case. Clear the time of last login
56 // with SAML and the flag enforcing online login, then return. 56 // with SAML and the flag enforcing online login, then return.
57 prefs->ClearPref(prefs::kSAMLLastGAIASignInTime); 57 prefs->ClearPref(prefs::kSAMLLastGAIASignInTime);
58 UserManager::Get()->SaveForceOnlineSignin(user_id, false); 58 GetUserManager()->SaveForceOnlineSignin(user_id, false);
59 return; 59 return;
60 } 60 }
61 61
62 if (auth_flow == UserContext::AUTH_FLOW_GAIA_WITH_SAML) { 62 if (auth_flow == UserContext::AUTH_FLOW_GAIA_WITH_SAML) {
63 // The user went through online authentication and GAIA did redirect to a 63 // The user went through online authentication and GAIA did redirect to a
64 // SAML IdP. Update the time of last login with SAML and clear the flag 64 // SAML IdP. Update the time of last login with SAML and clear the flag
65 // enforcing online login. The flag will be set again when the limit 65 // enforcing online login. The flag will be set again when the limit
66 // expires. If the limit already expired (e.g. because it was set to zero), 66 // expires. If the limit already expired (e.g. because it was set to zero),
67 // the flag will be set again immediately. 67 // the flag will be set again immediately.
68 UserManager::Get()->SaveForceOnlineSignin(user_id, false); 68 GetUserManager()->SaveForceOnlineSignin(user_id, false);
69 prefs->SetInt64(prefs::kSAMLLastGAIASignInTime, 69 prefs->SetInt64(prefs::kSAMLLastGAIASignInTime,
70 clock_->Now().ToInternalValue()); 70 clock_->Now().ToInternalValue());
71 } 71 }
72 72
73 // Start listening for pref changes. 73 // Start listening for pref changes.
74 pref_change_registrar_.Init(prefs); 74 pref_change_registrar_.Init(prefs);
75 pref_change_registrar_.Add(prefs::kSAMLOfflineSigninTimeLimit, 75 pref_change_registrar_.Add(prefs::kSAMLOfflineSigninTimeLimit,
76 base::Bind(&SAMLOfflineSigninLimiter::UpdateLimit, 76 base::Bind(&SAMLOfflineSigninLimiter::UpdateLimit,
77 base::Unretained(this))); 77 base::Unretained(this)));
78 78
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 &SAMLOfflineSigninLimiter::ForceOnlineLogin); 139 &SAMLOfflineSigninLimiter::ForceOnlineLogin);
140 } 140 }
141 141
142 void SAMLOfflineSigninLimiter::ForceOnlineLogin() { 142 void SAMLOfflineSigninLimiter::ForceOnlineLogin() {
143 User* user = ProfileHelper::Get()->GetUserByProfile(profile_); 143 User* user = ProfileHelper::Get()->GetUserByProfile(profile_);
144 if (!user) { 144 if (!user) {
145 NOTREACHED(); 145 NOTREACHED();
146 return; 146 return;
147 } 147 }
148 148
149 UserManager::Get()->SaveForceOnlineSignin(user->email(), true); 149 GetUserManager()->SaveForceOnlineSignin(user->email(), true);
150 offline_signin_limit_timer_.reset(); 150 offline_signin_limit_timer_.reset();
151 } 151 }
152 152
153 } // namespace chromeos 153 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/saml/saml_browsertest.cc ('k') | chrome/browser/chromeos/login/screens/user_image_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698