OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/net/gaia/gaia_auth_consumer.h" | 5 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
6 | 6 |
| 7 #include "base/logging.h" |
| 8 |
7 GaiaAuthConsumer::ClientLoginResult::ClientLoginResult() | 9 GaiaAuthConsumer::ClientLoginResult::ClientLoginResult() |
8 : two_factor(false) { | 10 : two_factor(false) { |
9 } | 11 } |
10 | 12 |
11 GaiaAuthConsumer::ClientLoginResult::ClientLoginResult( | 13 GaiaAuthConsumer::ClientLoginResult::ClientLoginResult( |
12 const std::string& new_sid, | 14 const std::string& new_sid, |
13 const std::string& new_lsid, | 15 const std::string& new_lsid, |
14 const std::string& new_token, | 16 const std::string& new_token, |
15 const std::string& new_data) | 17 const std::string& new_data) |
16 : sid(new_sid), | 18 : sid(new_sid), |
17 lsid(new_lsid), | 19 lsid(new_lsid), |
18 token(new_token), | 20 token(new_token), |
19 data(new_data), | 21 data(new_data), |
20 two_factor(false) {} | 22 two_factor(false) {} |
21 | 23 |
22 GaiaAuthConsumer::ClientLoginResult::~ClientLoginResult() {} | 24 GaiaAuthConsumer::ClientLoginResult::~ClientLoginResult() {} |
23 | 25 |
24 bool GaiaAuthConsumer::ClientLoginResult::operator==( | 26 bool GaiaAuthConsumer::ClientLoginResult::operator==( |
25 const ClientLoginResult &b) const { | 27 const ClientLoginResult &b) const { |
26 return sid == b.sid && | 28 return sid == b.sid && |
27 lsid == b.lsid && | 29 lsid == b.lsid && |
28 token == b.token && | 30 token == b.token && |
29 data == b.data && | 31 data == b.data && |
30 two_factor == b.two_factor; | 32 two_factor == b.two_factor; |
31 } | 33 } |
| 34 |
| 35 // virtual |
| 36 void GaiaAuthConsumer::OnAuthenticationSuccess( |
| 37 const AuthenticationConsumer::AuthenticationResult& result) { |
| 38 OnClientLoginSuccess( |
| 39 static_cast<const GaiaAuthConsumer::ClientLoginResult&>(result)); |
| 40 } |
| 41 |
| 42 // virtual |
| 43 void GaiaAuthConsumer::OnAuthenticationFailure( |
| 44 const GoogleServiceAuthError& error) { |
| 45 OnClientLoginFailure(error); |
| 46 } |
| 47 |
| 48 // virtual |
| 49 bool GaiaAuthConsumer::ClientLoginResult::IsValid() const { |
| 50 return !lsid.empty() && !sid.empty(); |
| 51 } |
OLD | NEW |