Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: google_apis/gaia/gaia_oauth_client.h

Issue 17109006: Device robot refresh token integrity validation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed atwilson's review comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 43e0c03226d05b6dac5dd9aaad05aac2d958970a..af7e143c7047e925f9b3ac2d527e43ed8076bb70 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_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) {};
// 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);
private:
// The guts of the implementation live in this class.

Powered by Google App Engine
This is Rietveld 408576698