• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_
6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_
7 #pragma once
8 
9 #include <string>
10 
11 class GoogleServiceAuthError;
12 
13 // An interface that defines the callbacks for objects that
14 // GaiaAuthFetcher can return data to.
15 class GaiaAuthConsumer {
16  public:
17   struct ClientLoginResult {
18     ClientLoginResult();
19     ClientLoginResult(const std::string& new_sid,
20                       const std::string& new_lsid,
21                       const std::string& new_token,
22                       const std::string& new_data);
23     ~ClientLoginResult();
24 
25     bool operator==(const ClientLoginResult &b) const;
26 
27     std::string sid;
28     std::string lsid;
29     std::string token;
30     // TODO(chron): Remove the data field later. Don't use it if possible.
31     std::string data;  // Full contents of ClientLogin return.
32     bool two_factor;  // set to true if there was a TWO_FACTOR "failure".
33   };
34 
~GaiaAuthConsumer()35   virtual ~GaiaAuthConsumer() {}
36 
OnClientLoginSuccess(const ClientLoginResult & result)37   virtual void OnClientLoginSuccess(const ClientLoginResult& result) {}
OnClientLoginFailure(const GoogleServiceAuthError & error)38   virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) {}
39 
OnIssueAuthTokenSuccess(const std::string & service,const std::string & auth_token)40   virtual void OnIssueAuthTokenSuccess(const std::string& service,
41                                        const std::string& auth_token) {}
OnIssueAuthTokenFailure(const std::string & service,const GoogleServiceAuthError & error)42   virtual void OnIssueAuthTokenFailure(const std::string& service,
43                                        const GoogleServiceAuthError& error) {}
44 
OnGetUserInfoSuccess(const std::string & key,const std::string & value)45   virtual void OnGetUserInfoSuccess(const std::string& key,
46                                     const std::string& value) {}
OnGetUserInfoKeyNotFound(const std::string & key)47   virtual void OnGetUserInfoKeyNotFound(const std::string& key) {}
OnGetUserInfoFailure(const GoogleServiceAuthError & error)48   virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) {}
49 };
50 
51 #endif  // CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_
52