Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_ | 5 #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_ |
| 6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_ | 6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 class GoogleServiceAuthError; | 11 class GoogleServiceAuthError; |
| 12 | 12 |
| 13 // An interface that defines the callbacks for objects that | 13 // An interface that defines the callbacks for objects that |
| 14 // GaiaAuthFetcher can return data to. | 14 // GaiaAuthFetcher can return data to. |
| 15 class GaiaAuthConsumer { | 15 class GaiaAuthConsumer { |
| 16 public: | 16 public: |
| 17 struct ClientLoginResult { | 17 struct ClientLoginResult { |
| 18 inline ClientLoginResult() : two_factor(false) {} | 18 ClientLoginResult(); |
|
Nico
2011/01/27 03:55:17
lol inline
but since it's mentioned explicitly, m
| |
| 19 inline ClientLoginResult(const std::string& new_sid, | 19 ClientLoginResult(const std::string& new_sid, |
| 20 const std::string& new_lsid, | 20 const std::string& new_lsid, |
| 21 const std::string& new_token, | 21 const std::string& new_token, |
| 22 const std::string& new_data) | 22 const std::string& new_data); |
| 23 : sid(new_sid), | 23 ~ClientLoginResult(); |
| 24 lsid(new_lsid), | |
| 25 token(new_token), | |
| 26 data(new_data), | |
| 27 two_factor(false) {} | |
| 28 | 24 |
| 29 inline bool operator==(const ClientLoginResult &b) const { | 25 bool operator==(const ClientLoginResult &b) const; |
| 30 return sid == b.sid && | |
| 31 lsid == b.lsid && | |
| 32 token == b.token && | |
| 33 data == b.data && | |
| 34 two_factor == b.two_factor; | |
| 35 } | |
| 36 | 26 |
| 37 std::string sid; | 27 std::string sid; |
| 38 std::string lsid; | 28 std::string lsid; |
| 39 std::string token; | 29 std::string token; |
| 40 // TODO(chron): Remove the data field later. Don't use it if possible. | 30 // TODO(chron): Remove the data field later. Don't use it if possible. |
| 41 std::string data; // Full contents of ClientLogin return. | 31 std::string data; // Full contents of ClientLogin return. |
| 42 bool two_factor; // set to true if there was a TWO_FACTOR "failure". | 32 bool two_factor; // set to true if there was a TWO_FACTOR "failure". |
| 43 }; | 33 }; |
| 44 | 34 |
| 45 virtual ~GaiaAuthConsumer() {} | 35 virtual ~GaiaAuthConsumer() {} |
| 46 | 36 |
| 47 virtual void OnClientLoginSuccess(const ClientLoginResult& result) {} | 37 virtual void OnClientLoginSuccess(const ClientLoginResult& result) {} |
| 48 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) {} | 38 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) {} |
| 49 | 39 |
| 50 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 40 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
| 51 const std::string& auth_token) {} | 41 const std::string& auth_token) {} |
| 52 virtual void OnIssueAuthTokenFailure(const std::string& service, | 42 virtual void OnIssueAuthTokenFailure(const std::string& service, |
| 53 const GoogleServiceAuthError& error) {} | 43 const GoogleServiceAuthError& error) {} |
| 54 | 44 |
| 55 virtual void OnGetUserInfoSuccess(const std::string& key, | 45 virtual void OnGetUserInfoSuccess(const std::string& key, |
| 56 const std::string& value) {} | 46 const std::string& value) {} |
| 57 virtual void OnGetUserInfoKeyNotFound(const std::string& key) {} | 47 virtual void OnGetUserInfoKeyNotFound(const std::string& key) {} |
| 58 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) {} | 48 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) {} |
| 59 }; | 49 }; |
| 60 | 50 |
| 61 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_ | 51 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_ |
| OLD | NEW |