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/auth/chrome_login_performer.h" | 5 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow.
h" | 10 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow.
h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 bool ChromeLoginPerformer::IsUserWhitelisted(const std::string& user_id, | 89 bool ChromeLoginPerformer::IsUserWhitelisted(const std::string& user_id, |
90 bool* wildcard_match) { | 90 bool* wildcard_match) { |
91 return CrosSettings::IsWhitelisted(user_id, wildcard_match); | 91 return CrosSettings::IsWhitelisted(user_id, wildcard_match); |
92 } | 92 } |
93 | 93 |
94 void ChromeLoginPerformer::RunOnlineWhitelistCheck( | 94 void ChromeLoginPerformer::RunOnlineWhitelistCheck( |
95 const std::string& user_id, | 95 const std::string& user_id, |
96 bool wildcard_match, | 96 bool wildcard_match, |
| 97 const std::string& refresh_token, |
97 const base::Closure& success_callback, | 98 const base::Closure& success_callback, |
98 const base::Closure& failure_callback) { | 99 const base::Closure& failure_callback) { |
99 // On enterprise devices, reconfirm login permission with the server. | 100 // On enterprise devices, reconfirm login permission with the server. |
100 policy::BrowserPolicyConnectorChromeOS* connector = | 101 policy::BrowserPolicyConnectorChromeOS* connector = |
101 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 102 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
102 if (connector->IsEnterpriseManaged() && wildcard_match && | 103 if (connector->IsEnterpriseManaged() && wildcard_match && |
103 !connector->IsNonEnterpriseUser(user_id)) { | 104 !connector->IsNonEnterpriseUser(user_id)) { |
104 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); | 105 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); |
105 wildcard_login_checker_->Start( | 106 if (refresh_token.empty()) { |
106 ProfileHelper::GetSigninProfile()->GetRequestContext(), | 107 wildcard_login_checker_->Start( |
107 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted, | 108 ProfileHelper::GetSigninProfile()->GetRequestContext(), |
108 weak_factory_.GetWeakPtr(), | 109 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted, |
109 success_callback, | 110 weak_factory_.GetWeakPtr(), success_callback, |
110 failure_callback)); | 111 failure_callback)); |
| 112 } else { |
| 113 wildcard_login_checker_->StartWithRefreshToken( |
| 114 refresh_token, |
| 115 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted, |
| 116 weak_factory_.GetWeakPtr(), success_callback, |
| 117 failure_callback)); |
| 118 } |
111 } else { | 119 } else { |
112 success_callback.Run(); | 120 success_callback.Run(); |
113 } | 121 } |
114 } | 122 } |
115 | 123 |
116 scoped_refptr<Authenticator> ChromeLoginPerformer::CreateAuthenticator() { | 124 scoped_refptr<Authenticator> ChromeLoginPerformer::CreateAuthenticator() { |
117 return UserSessionManager::GetInstance()->CreateAuthenticator(this); | 125 return UserSessionManager::GetInstance()->CreateAuthenticator(this); |
118 } | 126 } |
119 | 127 |
120 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { | 128 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 const base::Closure& failure_callback, | 179 const base::Closure& failure_callback, |
172 policy::WildcardLoginChecker::Result result) { | 180 policy::WildcardLoginChecker::Result result) { |
173 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { | 181 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { |
174 success_callback.Run(); | 182 success_callback.Run(); |
175 } else { | 183 } else { |
176 failure_callback.Run(); | 184 failure_callback.Run(); |
177 } | 185 } |
178 } | 186 } |
179 | 187 |
180 } // namespace chromeos | 188 } // namespace chromeos |
OLD | NEW |