| 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 "chromeos/login/auth/login_performer.h" | 5 #include "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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (delegate_) { | 66 if (delegate_) { |
| 67 delegate_->OnAuthFailure(failure); | 67 delegate_->OnAuthFailure(failure); |
| 68 return; | 68 return; |
| 69 } else { | 69 } else { |
| 70 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: | 70 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: |
| 71 // happens during offline auth only. | 71 // happens during offline auth only. |
| 72 NOTREACHED(); | 72 NOTREACHED(); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void LoginPerformer::OnRetailModeAuthSuccess(const UserContext& user_context) { | |
| 77 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | |
| 78 base::RecordAction(UserMetricsAction("Login_DemoUserLoginSuccess")); | |
| 79 AuthStatusConsumer::OnRetailModeAuthSuccess(user_context); | |
| 80 } | |
| 81 | |
| 82 void LoginPerformer::OnAuthSuccess(const UserContext& user_context) { | 76 void LoginPerformer::OnAuthSuccess(const UserContext& user_context) { |
| 83 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 77 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 84 base::RecordAction(UserMetricsAction("Login_Success")); | 78 base::RecordAction(UserMetricsAction("Login_Success")); |
| 85 VLOG(1) << "LoginSuccess hash: " << user_context.GetUserIDHash(); | 79 VLOG(1) << "LoginSuccess hash: " << user_context.GetUserIDHash(); |
| 86 DCHECK(delegate_); | 80 DCHECK(delegate_); |
| 87 // After delegate_->OnAuthSuccess(...) is called, delegate_ releases | 81 // After delegate_->OnAuthSuccess(...) is called, delegate_ releases |
| 88 // LoginPerformer ownership. LP now manages it's lifetime on its own. | 82 // LoginPerformer ownership. LP now manages it's lifetime on its own. |
| 89 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 83 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 90 delegate_->OnAuthSuccess(user_context); | 84 delegate_->OnAuthSuccess(user_context); |
| 91 } | 85 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 return; | 221 return; |
| 228 } | 222 } |
| 229 | 223 |
| 230 EnsureAuthenticator(); | 224 EnsureAuthenticator(); |
| 231 task_runner_->PostTask(FROM_HERE, | 225 task_runner_->PostTask(FROM_HERE, |
| 232 base::Bind(&Authenticator::LoginAsPublicSession, | 226 base::Bind(&Authenticator::LoginAsPublicSession, |
| 233 authenticator_.get(), | 227 authenticator_.get(), |
| 234 user_context)); | 228 user_context)); |
| 235 } | 229 } |
| 236 | 230 |
| 237 void LoginPerformer::LoginRetailMode() { | |
| 238 EnsureAuthenticator(); | |
| 239 task_runner_->PostTask( | |
| 240 FROM_HERE, | |
| 241 base::Bind(&Authenticator::LoginRetailMode, authenticator_.get())); | |
| 242 } | |
| 243 | |
| 244 void LoginPerformer::LoginOffTheRecord() { | 231 void LoginPerformer::LoginOffTheRecord() { |
| 245 EnsureAuthenticator(); | 232 EnsureAuthenticator(); |
| 246 task_runner_->PostTask( | 233 task_runner_->PostTask( |
| 247 FROM_HERE, | 234 FROM_HERE, |
| 248 base::Bind(&Authenticator::LoginOffTheRecord, authenticator_.get())); | 235 base::Bind(&Authenticator::LoginOffTheRecord, authenticator_.get())); |
| 249 } | 236 } |
| 250 | 237 |
| 251 void LoginPerformer::LoginAsKioskAccount(const std::string& app_user_id, | 238 void LoginPerformer::LoginAsKioskAccount(const std::string& app_user_id, |
| 252 bool use_guest_mount) { | 239 bool use_guest_mount) { |
| 253 EnsureAuthenticator(); | 240 EnsureAuthenticator(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } else { | 297 } else { |
| 311 NOTREACHED(); | 298 NOTREACHED(); |
| 312 } | 299 } |
| 313 user_context_.ClearSecrets(); | 300 user_context_.ClearSecrets(); |
| 314 } | 301 } |
| 315 | 302 |
| 316 void LoginPerformer::EnsureAuthenticator() { | 303 void LoginPerformer::EnsureAuthenticator() { |
| 317 authenticator_ = CreateAuthenticator(); | 304 authenticator_ = CreateAuthenticator(); |
| 318 } | 305 } |
| 319 } // namespace chromeos | 306 } // namespace chromeos |
| OLD | NEW |