| 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 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 const UserContext& user_context) { | 28 const UserContext& user_context) { |
| 29 authentication_context_ = context; | 29 authentication_context_ = context; |
| 30 if (expected_user_context_ != user_context) | 30 if (expected_user_context_ != user_context) |
| 31 NOTREACHED(); | 31 NOTREACHED(); |
| 32 OnAuthSuccess(); | 32 OnAuthSuccess(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void StubAuthenticator::AuthenticateToLogin(content::BrowserContext* context, | 35 void StubAuthenticator::AuthenticateToLogin(content::BrowserContext* context, |
| 36 const UserContext& user_context) { | 36 const UserContext& user_context) { |
| 37 authentication_context_ = context; | 37 authentication_context_ = context; |
| 38 if (user_context == expected_user_context_) { | 38 // Don't compare the entire |expected_user_context_| to |user_context| because |
| 39 // during non-online re-auth |user_context| does not have a gaia id. |
| 40 if (expected_user_context_.GetUserID() == user_context.GetUserID() && |
| 41 *expected_user_context_.GetKey() == *user_context.GetKey()) { |
| 39 message_loop_->PostTask( | 42 message_loop_->PostTask( |
| 40 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthSuccess, this)); | 43 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthSuccess, this)); |
| 41 return; | 44 return; |
| 42 } | 45 } |
| 43 GoogleServiceAuthError error( | 46 GoogleServiceAuthError error( |
| 44 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 47 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
| 45 message_loop_->PostTask( | 48 message_loop_->PostTask( |
| 46 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, | 49 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, |
| 47 AuthFailure::FromNetworkAuthFailure(error))); | 50 AuthFailure::FromNetworkAuthFailure(error))); |
| 48 } | 51 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 102 |
| 100 void StubAuthenticator::SetExpectedCredentials( | 103 void StubAuthenticator::SetExpectedCredentials( |
| 101 const UserContext& user_context) { | 104 const UserContext& user_context) { |
| 102 expected_user_context_ = user_context; | 105 expected_user_context_ = user_context; |
| 103 } | 106 } |
| 104 | 107 |
| 105 StubAuthenticator::~StubAuthenticator() { | 108 StubAuthenticator::~StubAuthenticator() { |
| 106 } | 109 } |
| 107 | 110 |
| 108 } // namespace chromeos | 111 } // namespace chromeos |
| OLD | NEW |