Chromium Code Reviews| Index: google_apis/gaia/gaia_oauth_client.h |
| diff --git a/google_apis/gaia/gaia_oauth_client.h b/google_apis/gaia/gaia_oauth_client.h |
| index 17d6dbd05beb52257bd609443b3c9b3ac1accabe..cda99a1f0b81830c087fcaa5565ff776dd9ffc2d 100644 |
| --- a/google_apis/gaia/gaia_oauth_client.h |
| +++ b/google_apis/gaia/gaia_oauth_client.h |
| @@ -6,15 +6,21 @@ |
| #define GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ |
| #include <string> |
| +#include <vector> |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/message_loop/message_loop_proxy.h" |
| +#include "base/values.h" |
| namespace net { |
| class URLRequestContextGetter; |
| } |
| // A helper class to get and refresh OAuth tokens given an authorization code. |
| +// Also exposes utility methods for fetching user email and token owner. |
| +// Supports one request at a time; for parallel requests, create multiple |
| +// instances. |
| namespace gaia { |
| struct OAuthClientInfo { |
| @@ -25,17 +31,22 @@ struct OAuthClientInfo { |
| class GaiaOAuthClient { |
| public: |
| + const static int kUrlFetcherId; |
| + |
| class Delegate { |
| public: |
| // Invoked on a successful response to the GetTokensFromAuthCode request. |
| virtual void OnGetTokensResponse(const std::string& refresh_token, |
| const std::string& access_token, |
| - int expires_in_seconds) = 0; |
| + int expires_in_seconds) {}; |
|
Roger Tawa OOO till Jul 10th
2013/06/21 18:22:41
don't need trailing ; here and lines 44 and 46.
David Roche
2013/06/21 18:40:45
Done.
|
| // Invoked on a successful response to the RefreshToken request. |
| virtual void OnRefreshTokenResponse(const std::string& access_token, |
| - int expires_in_seconds) = 0; |
| + int expires_in_seconds) {}; |
| // Invoked on a successful response to the GetUserInfo request. |
| virtual void OnGetUserInfoResponse(const std::string& user_email) {}; |
| + // Invoked on a successful response to the GetTokenInfo request. |
| + virtual void OnGetTokenInfoResponse( |
| + scoped_ptr<DictionaryValue> token_info) {}; |
| // Invoked when there is an OAuth error with one of the requests. |
| virtual void OnOAuthError() = 0; |
| // Invoked when there is a network error or upon receiving an invalid |
| @@ -46,8 +57,8 @@ class GaiaOAuthClient { |
| protected: |
| virtual ~Delegate() {} |
| }; |
| - GaiaOAuthClient(const std::string& gaia_url, |
| - net::URLRequestContextGetter* context_getter); |
| + |
| + GaiaOAuthClient(net::URLRequestContextGetter* context_getter); |
| ~GaiaOAuthClient(); |
| // In the below methods, |max_retries| specifies the maximum number of times |
| @@ -60,11 +71,15 @@ class GaiaOAuthClient { |
| Delegate* delegate); |
| void RefreshToken(const OAuthClientInfo& oauth_client_info, |
| const std::string& refresh_token, |
| + const std::vector<std::string>& scopes, |
| int max_retries, |
| Delegate* delegate); |
| void GetUserInfo(const std::string& oauth_access_token, |
| int max_retries, |
| Delegate* delegate); |
| + void GetTokenInfo(const std::string& oauth_access_token, |
| + int max_retries, |
| + Delegate* delegate); |
|
Roger Tawa OOO till Jul 10th
2013/06/21 18:22:41
Can you please document the args for these three m
David Roche
2013/06/21 18:40:45
Sure, I can document this. Can I do this in a CL
|
| private: |
| // The guts of the implementation live in this class. |