| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const int kDefaultSAMLOfflineSigninTimeLimit = 14 * 24 * 60 * 60; // 14 days. | 27 const int kDefaultSAMLOfflineSigninTimeLimit = 14 * 24 * 60 * 60; // 14 days. |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 // static | 31 // static |
| 32 void SAMLOfflineSigninLimiter::RegisterProfilePrefs( | 32 void SAMLOfflineSigninLimiter::RegisterProfilePrefs( |
| 33 user_prefs::PrefRegistrySyncable* registry) { | 33 user_prefs::PrefRegistrySyncable* registry) { |
| 34 registry->RegisterIntegerPref( | 34 registry->RegisterIntegerPref(prefs::kSAMLOfflineSigninTimeLimit, |
| 35 prefs::kSAMLOfflineSigninTimeLimit, | 35 kDefaultSAMLOfflineSigninTimeLimit); |
| 36 kDefaultSAMLOfflineSigninTimeLimit, | 36 registry->RegisterInt64Pref(prefs::kSAMLLastGAIASignInTime, 0); |
| 37 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 38 registry->RegisterInt64Pref( | |
| 39 prefs::kSAMLLastGAIASignInTime, | |
| 40 0, | |
| 41 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 42 } | 37 } |
| 43 | 38 |
| 44 void SAMLOfflineSigninLimiter::SignedIn(UserContext::AuthFlow auth_flow) { | 39 void SAMLOfflineSigninLimiter::SignedIn(UserContext::AuthFlow auth_flow) { |
| 45 PrefService* prefs = profile_->GetPrefs(); | 40 PrefService* prefs = profile_->GetPrefs(); |
| 46 const user_manager::User* user = | 41 const user_manager::User* user = |
| 47 ProfileHelper::Get()->GetUserByProfile(profile_); | 42 ProfileHelper::Get()->GetUserByProfile(profile_); |
| 48 if (!user) { | 43 if (!user) { |
| 49 NOTREACHED(); | 44 NOTREACHED(); |
| 50 return; | 45 return; |
| 51 } | 46 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (!user) { | 141 if (!user) { |
| 147 NOTREACHED(); | 142 NOTREACHED(); |
| 148 return; | 143 return; |
| 149 } | 144 } |
| 150 | 145 |
| 151 user_manager::UserManager::Get()->SaveForceOnlineSignin(user->email(), true); | 146 user_manager::UserManager::Get()->SaveForceOnlineSignin(user->email(), true); |
| 152 offline_signin_limit_timer_.reset(); | 147 offline_signin_limit_timer_.reset(); |
| 153 } | 148 } |
| 154 | 149 |
| 155 } // namespace chromeos | 150 } // namespace chromeos |
| OLD | NEW |