Chromium Code Reviews| Index: remoting/host/setup/oauth_client.h |
| diff --git a/remoting/host/setup/oauth_client.h b/remoting/host/setup/oauth_client.h |
| index 5cc8f1f3bcfe099ac1e6cacb25db9dd7adbd7cba..9f76925f5ff0e94e212f0d7fc60dbcdd9ef3461a 100644 |
| --- a/remoting/host/setup/oauth_client.h |
| +++ b/remoting/host/setup/oauth_client.h |
| @@ -19,9 +19,7 @@ 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 { |
| +class OAuthClient { |
| public: |
| // Called when GetCredentialsFromAuthCode is completed, with the |user_email| |
| // and |refresh_token| that correspond to the given |auth_code|, or with empty |
| @@ -30,10 +28,30 @@ class OAuthClient : public gaia::GaiaOAuthClient::Delegate { |
| const std::string& user_email, |
| const std::string& refresh_token)> CompletionCallback; |
| - OAuthClient( |
| + virtual ~OAuthClient(); |
|
Lambros
2015/04/24 18:15:50
You should inline this dtor, because this class is
John Williams
2015/04/24 21:05:13
Done.
|
| + |
| + // 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. |
| + virtual void GetCredentialsFromAuthCode( |
| + const gaia::OAuthClientInfo& oauth_client_info, |
| + const std::string& auth_code, |
| + CompletionCallback on_done) = 0; |
| +}; |
| + |
| +// A wrapper around GaiaOAuthClient that provides a more convenient interface, |
|
Lambros
2015/04/24 18:15:50
nit: gaia::GaiaOAuthClient, because of the naming
John Williams
2015/04/24 21:05:13
Done.
|
| +// with queueing of requests and a callback rather than a delegate. |
| +class GaiaOAuthClient : |
|
Lambros
2015/04/24 18:15:50
I think this should be in its own file, gaia_oauth
John Williams
2015/04/24 21:05:13
Done.
|
| + public OAuthClient, |
| + public gaia::GaiaOAuthClient::Delegate { |
| + public: |
| + 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 uses the userinfo endpoint to obtain |user_email|. |
| @@ -44,7 +62,7 @@ class OAuthClient : public gaia::GaiaOAuthClient::Delegate { |
| void GetCredentialsFromAuthCode( |
| const gaia::OAuthClientInfo& oauth_client_info, |
| const std::string& auth_code, |
| - CompletionCallback on_done); |
| + CompletionCallback on_done) override; |
| // gaia::GaiaOAuthClient::Delegate |
| void OnGetTokensResponse(const std::string& refresh_token, |
| @@ -76,7 +94,7 @@ class OAuthClient : public gaia::GaiaOAuthClient::Delegate { |
| std::string refresh_token_; |
| CompletionCallback on_done_; |
| - DISALLOW_COPY_AND_ASSIGN(OAuthClient); |
| + DISALLOW_COPY_AND_ASSIGN(GaiaOAuthClient); |
| }; |
| } // namespace remoting |