Chromium Code Reviews| 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/login_performer.h" | 5 #include "chrome/browser/chromeos/login/auth/login_performer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 if (delegate_) { | 79 if (delegate_) { |
| 80 delegate_->OnAuthFailure(failure); | 80 delegate_->OnAuthFailure(failure); |
| 81 return; | 81 return; |
| 82 } else { | 82 } else { |
| 83 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: | 83 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: |
| 84 // happens during offline auth only. | 84 // happens during offline auth only. |
| 85 NOTREACHED(); | 85 NOTREACHED(); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 void LoginPerformer::OnRetailModeAuthSuccess(const UserContext& user_context) { | |
| 90 content::RecordAction( | |
| 91 UserMetricsAction("Login_DemoUserLoginSuccess")); | |
|
bartfab (slow)
2014/10/15 09:52:20
Should this action be removed from |tools/metrics/
rkc
2014/11/20 21:06:33
Marked it obsolete.
Done.
| |
| 92 AuthStatusConsumer::OnRetailModeAuthSuccess(user_context); | |
| 93 } | |
| 94 | |
| 95 void LoginPerformer::OnAuthSuccess(const UserContext& user_context) { | 89 void LoginPerformer::OnAuthSuccess(const UserContext& user_context) { |
| 96 content::RecordAction(UserMetricsAction("Login_Success")); | 90 content::RecordAction(UserMetricsAction("Login_Success")); |
| 97 VLOG(1) << "LoginSuccess hash: " << user_context.GetUserIDHash(); | 91 VLOG(1) << "LoginSuccess hash: " << user_context.GetUserIDHash(); |
| 98 DCHECK(delegate_); | 92 DCHECK(delegate_); |
| 99 // After delegate_->OnAuthSuccess(...) is called, delegate_ releases | 93 // After delegate_->OnAuthSuccess(...) is called, delegate_ releases |
| 100 // LoginPerformer ownership. LP now manages it's lifetime on its own. | 94 // LoginPerformer ownership. LP now manages it's lifetime on its own. |
| 101 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 95 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 102 delegate_->OnAuthSuccess(user_context); | 96 delegate_->OnAuthSuccess(user_context); |
| 103 } | 97 } |
| 104 | 98 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 251 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 258 BrowserThread::PostTask( | 252 BrowserThread::PostTask( |
| 259 BrowserThread::UI, | 253 BrowserThread::UI, |
| 260 FROM_HERE, | 254 FROM_HERE, |
| 261 base::Bind(&Authenticator::LoginAsSupervisedUser, | 255 base::Bind(&Authenticator::LoginAsSupervisedUser, |
| 262 authenticator_.get(), | 256 authenticator_.get(), |
| 263 user_context_copy)); | 257 user_context_copy)); |
| 264 } | 258 } |
| 265 } | 259 } |
| 266 | 260 |
| 267 void LoginPerformer::LoginRetailMode() { | |
| 268 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | |
| 269 BrowserThread::PostTask( | |
| 270 BrowserThread::UI, FROM_HERE, | |
| 271 base::Bind(&Authenticator::LoginRetailMode, authenticator_.get())); | |
| 272 } | |
| 273 | |
| 274 void LoginPerformer::LoginOffTheRecord() { | 261 void LoginPerformer::LoginOffTheRecord() { |
| 275 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 262 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 276 BrowserThread::PostTask( | 263 BrowserThread::PostTask( |
| 277 BrowserThread::UI, FROM_HERE, | 264 BrowserThread::UI, FROM_HERE, |
| 278 base::Bind(&Authenticator::LoginOffTheRecord, authenticator_.get())); | 265 base::Bind(&Authenticator::LoginOffTheRecord, authenticator_.get())); |
| 279 } | 266 } |
| 280 | 267 |
| 281 void LoginPerformer::LoginAsPublicSession(const UserContext& user_context) { | 268 void LoginPerformer::LoginAsPublicSession(const UserContext& user_context) { |
| 282 // Login is not allowed if policy could not be loaded for the account. | 269 // Login is not allowed if policy could not be loaded for the account. |
| 283 policy::BrowserPolicyConnectorChromeOS* connector = | 270 policy::BrowserPolicyConnectorChromeOS* connector = |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 policy::WildcardLoginChecker::Result result) { | 350 policy::WildcardLoginChecker::Result result) { |
| 364 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { | 351 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { |
| 365 StartLoginCompletion(); | 352 StartLoginCompletion(); |
| 366 } else { | 353 } else { |
| 367 if (delegate_) | 354 if (delegate_) |
| 368 delegate_->WhiteListCheckFailed(user_context_.GetUserID()); | 355 delegate_->WhiteListCheckFailed(user_context_.GetUserID()); |
| 369 } | 356 } |
| 370 } | 357 } |
| 371 | 358 |
| 372 } // namespace chromeos | 359 } // namespace chromeos |
| OLD | NEW |