Index: remoting/host/setup/gaia_oauth_client.h |
diff --git a/remoting/host/setup/oauth_client.h b/remoting/host/setup/gaia_oauth_client.h |
similarity index 59% |
copy from remoting/host/setup/oauth_client.h |
copy to remoting/host/setup/gaia_oauth_client.h |
index 79d1d9a9b5988ed73e80f53006f0584e7135648b..d6bb72cbc00aff1400b7571c523df3671369e47d 100644 |
--- a/remoting/host/setup/oauth_client.h |
+++ b/remoting/host/setup/gaia_oauth_client.h |
@@ -2,51 +2,45 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef REMOTING_HOST_SETUP_OAUTH_CLIENT |
-#define REMOTING_HOST_SETUP_OAUTH_CLIENT |
+#ifndef REMOTING_HOST_SETUP_GAIA_OAUTH_CLIENT_H_ |
+#define REMOTING_HOST_SETUP_GAIA_OAUTH_CLIENT_H_ |
#include <queue> |
-#include <string> |
-#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "google_apis/gaia/gaia_oauth_client.h" |
#include "net/url_request/url_request_context_getter.h" |
+#include "remoting/host/setup/oauth_client.h" |
+ |
namespace net { |
class URLRequestContext; |
} |
namespace remoting { |
-// A wrapper around GaiaOAuthClient that provides a more convenient interface, |
-// with queueing of requests and a callback rather than a delegate. |
-class OAuthClient : public gaia::GaiaOAuthClient::Delegate { |
+// A wrapper around gaia::GaiaOAuthClient that provides a more |
+// convenient interface, with queueing of requests and a callback |
+// rather than a delegate. |
+class GaiaOAuthClient : public OAuthClient, |
+ public gaia::GaiaOAuthClient::Delegate { |
public: |
- // Called when GetCredentialsFromAuthCode is completed, with the |user_email| |
- // and |refresh_token| that correspond to the given |auth_code|, or with empty |
- // strings on error. |
- typedef base::Callback<void( |
- const std::string& user_email, |
- const std::string& refresh_token)> CompletionCallback; |
- |
- OAuthClient( |
+ GaiaOAuthClient( |
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); |
- ~OAuthClient() override; |
+ ~GaiaOAuthClient() override; |
- // Redeems |auth_code| using |oauth_client_info| to obtain |
- // |refresh_token| and |access_token|, then, if |need_user_email| is |
- // true, uses the userinfo endpoint to obtain |user_email|. Calls |
- // CompletionCallback with |user_email| and |refresh_token| when |
- // done, or with empty strings on error. If a request is received |
- // while another one is being processed, it is enqueued and |
- // processed after the first one is finished. |
+ // Redeems |auth_code| using |oauth_client_info| to obtain |refresh_token| and |
+ // |access_token|, then uses the userinfo endpoint to obtain |user_email|. |
+ // Calls CompletionCallback with |user_email| and |refresh_token| when done, |
+ // or with empty strings on error. |
+ // If a request is received while another one is being processed, it is |
+ // enqueued and processed after the first one is finished. |
void GetCredentialsFromAuthCode( |
const gaia::OAuthClientInfo& oauth_client_info, |
const std::string& auth_code, |
bool need_user_email, |
- CompletionCallback on_done); |
+ CompletionCallback on_done) override; |
// gaia::GaiaOAuthClient::Delegate |
void OnGetTokensResponse(const std::string& refresh_token, |
@@ -81,9 +75,9 @@ class OAuthClient : public gaia::GaiaOAuthClient::Delegate { |
bool need_user_email_; |
CompletionCallback on_done_; |
- DISALLOW_COPY_AND_ASSIGN(OAuthClient); |
+ DISALLOW_COPY_AND_ASSIGN(GaiaOAuthClient); |
}; |
} // namespace remoting |
-#endif // REMOTING_HOST_SETUP_OAUTH_CLIENT |
+#endif // REMOTING_HOST_SETUP_GAIA_OAUTH_CLIENT_H_ |