diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 04:26:37 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 04:26:37 +0000 |
commit | 6386cf58a85361fa20bba6ecfc23502e922b9a90 (patch) | |
tree | 06f9a9aa7e6bb8db149b53bc7489e69fa87c07fb /google_apis/gaia/gaia_auth_consumer.h | |
parent | f2857ecf6c8da488feeca9b05cf2c046ea43e02f (diff) | |
download | chromium_src-6386cf58a85361fa20bba6ecfc23502e922b9a90.zip chromium_src-6386cf58a85361fa20bba6ecfc23502e922b9a90.tar.gz chromium_src-6386cf58a85361fa20bba6ecfc23502e922b9a90.tar.bz2 |
Moving google_apis and GaiaClient to src/google_apis.
TBR=mechanicalowners@chromium.org
BUG=145584
Review URL: https://chromiumcodereview.appspot.com/10928017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/gaia_auth_consumer.h')
-rw-r--r-- | google_apis/gaia/gaia_auth_consumer.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/google_apis/gaia/gaia_auth_consumer.h b/google_apis/gaia/gaia_auth_consumer.h new file mode 100644 index 0000000..aa84439 --- /dev/null +++ b/google_apis/gaia/gaia_auth_consumer.h @@ -0,0 +1,85 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_CONSUMER_H_ +#define GOOGLE_APIS_GAIA_GAIA_AUTH_CONSUMER_H_ + +#include <map> +#include <string> +#include <vector> + +class GoogleServiceAuthError; + +namespace net { +typedef std::vector<std::string> ResponseCookies; +} + +typedef std::map<std::string, std::string> UserInfoMap; + +// An interface that defines the callbacks for objects that +// GaiaAuthFetcher can return data to. +class GaiaAuthConsumer { + public: + struct ClientLoginResult { + ClientLoginResult(); + ClientLoginResult(const std::string& new_sid, + const std::string& new_lsid, + const std::string& new_token, + const std::string& new_data); + ~ClientLoginResult(); + + bool operator==(const ClientLoginResult &b) const; + + std::string sid; + std::string lsid; + std::string token; + // TODO(chron): Remove the data field later. Don't use it if possible. + std::string data; // Full contents of ClientLogin return. + bool two_factor; // set to true if there was a TWO_FACTOR "failure". + }; + + struct ClientOAuthResult { + ClientOAuthResult(); + ClientOAuthResult(const std::string& new_refresh_token, + const std::string& new_access_token, + int new_expires_in_secs); + ~ClientOAuthResult(); + + bool operator==(const ClientOAuthResult &b) const; + + // OAuth2 refresh token. Used to mint new access tokens when needed. + std::string refresh_token; + + // OAuth2 access token. Token to pass to endpoints that require oauth2 + // authentication. + std::string access_token; + + // The lifespan of |access_token| in seconds. + int expires_in_secs; + }; + + virtual ~GaiaAuthConsumer() {} + + virtual void OnClientLoginSuccess(const ClientLoginResult& result) {} + virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) {} + + virtual void OnIssueAuthTokenSuccess(const std::string& service, + const std::string& auth_token) {} + virtual void OnIssueAuthTokenFailure(const std::string& service, + const GoogleServiceAuthError& error) {} + + virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) {} + virtual void OnClientOAuthFailure(const GoogleServiceAuthError& error) {} + + virtual void OnGetUserInfoSuccess(const UserInfoMap& data) {} + virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) {} + + virtual void OnUberAuthTokenSuccess(const std::string& token) {} + virtual void OnUberAuthTokenFailure(const GoogleServiceAuthError& error) {} + + virtual void OnMergeSessionSuccess(const std::string& data) {} + virtual void OnMergeSessionFailure(const GoogleServiceAuthError& error) {} +}; + +#endif // GOOGLE_APIS_GAIA_GAIA_AUTH_CONSUMER_H_ |