Home | History | Annotate | Download | only in gaia
      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 
     35   virtual ~GaiaAuthConsumer() {}
     36 
     37   virtual void OnClientLoginSuccess(const ClientLoginResult& result) {}
     38   virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) {}
     39 
     40   virtual void OnIssueAuthTokenSuccess(const std::string& service,
     41                                        const std::string& auth_token) {}
     42   virtual void OnIssueAuthTokenFailure(const std::string& service,
     43                                        const GoogleServiceAuthError& error) {}
     44 
     45   virtual void OnGetUserInfoSuccess(const std::string& key,
     46                                     const std::string& value) {}
     47   virtual void OnGetUserInfoKeyNotFound(const std::string& key) {}
     48   virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) {}
     49 };
     50 
     51 #endif  // CHROME_COMMON_NET_GAIA_GAIA_AUTH_CONSUMER_H_
     52