OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_SETUP_OAUTH_CLIENT_H_ | 5 #ifndef REMOTING_BASE_OAUTH_CLIENT_H_ |
6 #define REMOTING_HOST_SETUP_OAUTH_CLIENT_H_ | 6 #define REMOTING_BASE_OAUTH_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 | 11 |
12 namespace gaia { | 12 namespace gaia { |
13 struct OAuthClientInfo; | 13 struct OAuthClientInfo; |
14 } | 14 } |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 | 17 |
18 class OAuthClient { | 18 class OAuthClient { |
19 public: | 19 public: |
20 // Called when GetCredentialsFromAuthCode is completed, with the |user_email| | 20 // Called when GetCredentialsFromAuthCode is completed, with the |user_email| |
21 // and |refresh_token| that correspond to the given |auth_code|, or with empty | 21 // and |refresh_token| that correspond to the given |auth_code|, or with empty |
22 // strings on error. | 22 // strings on error. |
23 typedef base::Callback<void( | 23 typedef base::Callback<void(const std::string& user_email, |
nicholss
2017/01/31 16:44:58
git cl format did these changes.
| |
24 const std::string& user_email, | 24 const std::string& refresh_token)> |
25 const std::string& refresh_token)> CompletionCallback; | 25 CompletionCallback; |
26 | 26 |
27 virtual ~OAuthClient() {} | 27 virtual ~OAuthClient() {} |
28 | 28 |
29 // Redeems |auth_code| using |oauth_client_info| to obtain | 29 // Redeems |auth_code| using |oauth_client_info| to obtain |
30 // |refresh_token| and |access_token|, then, if |need_user_email| is | 30 // |refresh_token| and |access_token|, then, if |need_user_email| is |
31 // true, uses the userinfo endpoint to obtain |user_email|. Calls | 31 // true, uses the userinfo endpoint to obtain |user_email|. Calls |
32 // CompletionCallback with |user_email| and |refresh_token| when | 32 // CompletionCallback with |user_email| and |refresh_token| when |
33 // done, or with empty strings on error. If a request is received | 33 // done, or with empty strings on error. If a request is received |
34 // while another one is being processed, it is enqueued and | 34 // while another one is being processed, it is enqueued and |
35 // processed after the first one is finished. | 35 // processed after the first one is finished. |
36 virtual void GetCredentialsFromAuthCode( | 36 virtual void GetCredentialsFromAuthCode( |
37 const gaia::OAuthClientInfo& oauth_client_info, | 37 const gaia::OAuthClientInfo& oauth_client_info, |
38 const std::string& auth_code, | 38 const std::string& auth_code, |
39 bool need_user_email, | 39 bool need_user_email, |
40 CompletionCallback on_done) = 0; | 40 CompletionCallback on_done) = 0; |
41 }; | 41 }; |
42 | 42 |
43 } // namespace remoting | 43 } // namespace remoting |
44 | 44 |
45 #endif // REMOTING_HOST_SETUP_OAUTH_CLIENT_H_ | 45 #endif // REMOTING_BASE_OAUTH_CLIENT_H_ |
OLD | NEW |