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

Unified Diff: components/policy/core/common/cloud/user_info_fetcher.h

Issue 257773002: Use new people.get api instead of oauth2/v1/userinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix user image manager tests Created 6 years, 8 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: components/policy/core/common/cloud/user_info_fetcher.h
diff --git a/components/policy/core/common/cloud/user_info_fetcher.h b/components/policy/core/common/cloud/user_info_fetcher.h
index c248d81b06852ccdddc8f5318a6fd8ed5f724d0b..0f4c25f533daa17808e3a237945ca1e26ee2b42e 100644
--- a/components/policy/core/common/cloud/user_info_fetcher.h
+++ b/components/policy/core/common/cloud/user_info_fetcher.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
#include "components/policy/policy_export.h"
+#include "google_apis/gaia/gaia_oauth_client.h"
#include "net/url_request/url_fetcher_delegate.h"
class GoogleServiceAuthError;
@@ -25,7 +26,7 @@ namespace policy {
// Class that makes a UserInfo request, parses the response, and notifies
// a provided Delegate when the request is complete.
-class POLICY_EXPORT UserInfoFetcher : public net::URLFetcherDelegate {
+class POLICY_EXPORT UserInfoFetcher {
public:
class POLICY_EXPORT Delegate {
public:
@@ -48,13 +49,25 @@ class POLICY_EXPORT UserInfoFetcher : public net::URLFetcherDelegate {
// Starts the UserInfo request, using the passed OAuth2 |access_token|.
void Start(const std::string& access_token);
- // net::URLFetcherDelegate implementation.
- virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
-
private:
- Delegate* delegate_;
- net::URLRequestContextGetter* context_;
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ class GaiaDelegate : public gaia::GaiaOAuthClient::Delegate {
+ public:
+ explicit GaiaDelegate(UserInfoFetcher::Delegate* delegate);
+
+ private:
+ // gaia::GaiaOAuthClient::Delegate implementation.
+ virtual void OnGetUserInfoResponse(
+ scoped_ptr<base::DictionaryValue> user_info) OVERRIDE;
+ virtual void OnOAuthError() OVERRIDE;
+ virtual void OnNetworkError(int response_code) OVERRIDE;
+
+ UserInfoFetcher::Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(GaiaDelegate);
+ };
+
+ GaiaDelegate delegate_;
+ gaia::GaiaOAuthClient gaia_client_;
DISALLOW_COPY_AND_ASSIGN(UserInfoFetcher);
};

Powered by Google App Engine
This is Rietveld 408576698