| 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/stub_authenticator.h" | 5 #include "chromeos/login/auth/stub_authenticator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void StubAuthenticator::LoginAsKioskAccount( | 77 void StubAuthenticator::LoginAsKioskAccount( |
| 78 const AccountId& /* app_account_id */, | 78 const AccountId& /* app_account_id */, |
| 79 bool use_guest_mount) { | 79 bool use_guest_mount) { |
| 80 UserContext user_context(expected_user_context_.GetAccountId()); | 80 UserContext user_context(expected_user_context_.GetAccountId()); |
| 81 user_context.SetIsUsingOAuth(false); | 81 user_context.SetIsUsingOAuth(false); |
| 82 user_context.SetUserIDHash( | 82 user_context.SetUserIDHash( |
| 83 expected_user_context_.GetAccountId().GetUserEmail() + kUserIdHashSuffix); | 83 expected_user_context_.GetAccountId().GetUserEmail() + kUserIdHashSuffix); |
| 84 consumer_->OnAuthSuccess(user_context); | 84 consumer_->OnAuthSuccess(user_context); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void StubAuthenticator::LoginAsArcKioskAccount( |
| 88 const AccountId& /* app_account_id */) { |
| 89 UserContext user_context(expected_user_context_.GetAccountId()); |
| 90 user_context.SetIsUsingOAuth(false); |
| 91 user_context.SetUserIDHash( |
| 92 expected_user_context_.GetAccountId().GetUserEmail() + kUserIdHashSuffix); |
| 93 consumer_->OnAuthSuccess(user_context); |
| 94 } |
| 95 |
| 87 void StubAuthenticator::OnAuthSuccess() { | 96 void StubAuthenticator::OnAuthSuccess() { |
| 88 // If we want to be more like the real thing, we could save the user ID | 97 // If we want to be more like the real thing, we could save the user ID |
| 89 // in AuthenticateToLogin, but there's not much of a point. | 98 // in AuthenticateToLogin, but there's not much of a point. |
| 90 UserContext user_context(expected_user_context_); | 99 UserContext user_context(expected_user_context_); |
| 91 user_context.SetUserIDHash( | 100 user_context.SetUserIDHash( |
| 92 expected_user_context_.GetAccountId().GetUserEmail() + kUserIdHashSuffix); | 101 expected_user_context_.GetAccountId().GetUserEmail() + kUserIdHashSuffix); |
| 93 consumer_->OnAuthSuccess(user_context); | 102 consumer_->OnAuthSuccess(user_context); |
| 94 } | 103 } |
| 95 | 104 |
| 96 void StubAuthenticator::OnAuthFailure(const AuthFailure& failure) { | 105 void StubAuthenticator::OnAuthFailure(const AuthFailure& failure) { |
| 97 consumer_->OnAuthFailure(failure); | 106 consumer_->OnAuthFailure(failure); |
| 98 } | 107 } |
| 99 | 108 |
| 100 void StubAuthenticator::RecoverEncryptedData(const std::string& old_password) { | 109 void StubAuthenticator::RecoverEncryptedData(const std::string& old_password) { |
| 101 } | 110 } |
| 102 | 111 |
| 103 void StubAuthenticator::ResyncEncryptedData() { | 112 void StubAuthenticator::ResyncEncryptedData() { |
| 104 } | 113 } |
| 105 | 114 |
| 106 void StubAuthenticator::SetExpectedCredentials( | 115 void StubAuthenticator::SetExpectedCredentials( |
| 107 const UserContext& user_context) { | 116 const UserContext& user_context) { |
| 108 expected_user_context_ = user_context; | 117 expected_user_context_ = user_context; |
| 109 } | 118 } |
| 110 | 119 |
| 111 StubAuthenticator::~StubAuthenticator() { | 120 StubAuthenticator::~StubAuthenticator() { |
| 112 } | 121 } |
| 113 | 122 |
| 114 } // namespace chromeos | 123 } // namespace chromeos |
| OLD | NEW |